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 5.0.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
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: community.network.ce_file_copy
.
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 |
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: |
|
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: |
|
The path of the local file. Returned: always Sample: |
|
The path of the remote file. Returned: always Sample: |
|
information about transfer result. Returned: always Sample: |