Documentation

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) flash is root directory of the flash memory on the master MPU. 2) slave#flash is root directory of the flash memory on the slave MPU. If no slave MPU exists, this drive is unavailable. 3) chassis ID/slot number#flash is root directory of the flash memory on a device in a stack. For example, 1/5#flash indicates the flash memory whose chassis ID is 1 and slot number is 5.
local_file
required
Path to local file. Local directory must exist. The maximum length of local_file is 4096.
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 4096.

Notes

Note

  • The feature must be enabled with feature scp-server.
  • If the file is already present, no transfer will take place.

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 flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Author

  • Zhou Zhijin (@CloudEngine-Ansible)

Hint

If you notice any issues in this documentation you can edit this document to improve it.