W3cubDocs

/Ansible

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.

Options

parameter required default choices comments
file_system
no 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
yes
Path to local file. Local directory must exist. The maximum length of local_file is 4096.
remote_file
no
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.

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 Return Values, the following are the fields unique to this module:

name description returned type sample
transfer_result
information about transfer result.
always string The local file has been successfully transferred to the device.
local_file
The path of the local file.
always string /usr/work/vrpcfg.zip
changed
check to see if a change was made on the device
always boolean True
remote_file
The path of the remote file.
always string /vrpcfg.zip

Notes

Note

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

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.

© 2012–2017 Michael DeHaan
© 2017 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/ce_file_copy_module.html