ce_file_copy – Copy a file to a remote cloudengine device over SCP on HUAWEI CloudEngine switches.

From Get docs
Ansible/docs/2.7/modules/ce file copy module


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

Authors

  • Zhou Zhijin (@CloudEngine-Ansible)

Hint

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


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