Added in version 1.8
Copy a local file to a remote Comware v7 device
parameter | required | default | choices | comments |
---|---|---|---|---|
file | yes | File (including absolute path of local file) that will be sent to the device | ||
flash | no | flash:/ | If no directory is included in remote_path, flash will be prepended. If remote_path is omitted, flash will be prepended to the source file name. | |
ftpupload | no | false |
|
If you want to upload by FTP, change the params to true |
ftpdownload | no | false |
|
If you want to download by FTP, change the params to true |
hostname | yes | IP Address or hostname of the Comware v7 device that has NETCONF enabled | ||
username | yes | Username used to login to the switch | ||
password | yes | Password used to login to the switch | ||
port | no | 830 | NETCONF port number | |
look_for_keys | no | False | Whether searching for discoverable private key files in ~/.ssh/ |
# copy file - comware_file_copy: file=/usr/smallfile remote_path=flash:/otherfile username={{ username }} password={{ password }} hostname={{ inventory_hostname }} - comware_file_copy: file=/root/ansible-hpe-cw7-master/hp-vlans.yml remote_path=flash:/ldx/hp-vlans.yml ftpupload=true username={{ username }} password={{ password }} hostname={{ inventory_hostname }} # name: use FTP to download files to the server--module 1.3 comware_file_copy: file=/root/ansible-hpe-cw7-master/11.txt remote_path=flash:/llld/11.txt ftpdownload=true username={{ username }} password={{ password }} hostname={{ inventory_hostname }}
Note
If the remote directory doesn't exist, it will be automaticallycreated.If you want to use FTP, you need to enable the FTP function on the device,e.g.[Sysname] local-user h3c class manage[Sysname-luser-manage-h3c] service-type ftp[Sysname] ftp server enableYou can configure it using the 'comware_local_user.py' and 'comware_ftp.py' modules first.