ce_file_copy – Copy a file to a remote cloudengine device over SCP on HUAWEI CloudEngine switches
ce_file_copy – Copy a file to a remote cloudengine device over SCP on HUAWEI CloudEngine switches
New in version 2.4.
Synopsis
- Copy a file to a remote cloudengine device over SCP on HUAWEI CloudEngine switches.
Requirements
The below requirements are needed on the host that executes this module.
- paramiko
Parameters
Parameter | Choices/Defaults | Comments |
---|---|---|
file_system - |
Default: "flash:" |
The remote file system of the device. If omitted, devices that support a file_system parameter will use their default values. File system indicates the storage medium and can be set to as follows, 1) |
local_file - / required |
Path to local file. Local directory must exist. The maximum length of local_file is | |
remote_file - |
Remote file path of the copy. Remote directories must exist. If omitted, the name of the local file will be used. The maximum length of remote_file is |
Notes
Note
- The feature must be enabled with feature scp-server.
- If the file is already present, no transfer will take place.
- This module requires the netconf system service be enabled on the remote device being managed.
- Recommended connection is
netconf
. - This module also works with
local
connections for legacy playbooks.
Examples
- name: File copy test
hosts: cloudengine
connection: local
gather_facts: no
vars:
cli:
host: "{{ inventory_hostname }}"
port: "{{ ansible_ssh_port }}"
username: "{{ username }}"
password: "{{ password }}"
transport: cli
tasks:
- name: "Copy a local file to remote device"
ce_file_copy:
local_file: /usr/vrpcfg.cfg
remote_file: /vrpcfg.cfg
file_system: 'flash:'
provider: "{{ cli }}"
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
changed boolean |
always |
check to see if a change was made on the device
Sample: True |
local_file string |
always |
The path of the local file.
Sample: /usr/work/vrpcfg.zip |
remote_file string |
always |
The path of the remote file.
Sample: /vrpcfg.zip |
transfer_result string |
always |
information about transfer result.
Sample: The local file has been successfully transferred to the device. |
Status
- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Community. [community]
Authors
- Zhou Zhijin (@QijunPan)
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.9/modules/ce_file_copy_module.html