community.network.ce_file_copy module – Copy a file to a remote cloudengine device over SCP on HUAWEI CloudEngine switches.
Note
This module is part of the community.network collection (version 3.3.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.network
.
To use it in a playbook, specify: community.network.ce_file_copy
.
Parameters
Parameter |
Comments |
---|---|
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) Default: “flash:” |
|
Path to local file. Local directory must exist. The maximum length of local_file is |
|
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"
community.network.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 |
Description |
---|---|
check to see if a change was made on the device Returned: always Sample: true |
|
The path of the local file. Returned: always Sample: “/usr/work/vrpcfg.zip” |
|
The path of the remote file. Returned: always Sample: “/vrpcfg.zip” |
|
information about transfer result. Returned: always Sample: “The local file has been successfully transferred to the device.” |
Authors
Zhou Zhijin (@QijunPan)