community.general.ce_file_copy (0.1.1) — module

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

Authors: Zhou Zhijin (@QijunPan)

preview | supported by community

Install collection

Install with ansible-galaxy collection install community.general:==0.1.1


Add to requirements.yml

  collections:
    - name: community.general
      version: 0.1.1

Description

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


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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 }}"

Inputs

    
local_file:
    description:
    - Path to local file. Local directory must exist. The maximum length of I(local_file)
      is C(4096).
    required: true

file_system:
    default: 'flash:'
    description:
    - The remote file system of the device. If omitted, devices that support a I(file_system)
      parameter will use their default values. File system indicates the storage medium
      and can be set to as follows, 1) C(flash) is root directory of the flash memory
      on the master MPU. 2) C(slave#flash) is root directory of the flash memory on the
      slave MPU. If no slave MPU exists, this drive is unavailable. 3) C(chassis ID/slot
      number#flash) is root directory of the flash memory on a device in a stack. For
      example, C(1/5#flash) indicates the flash memory whose chassis ID is 1 and slot
      number is 5.

remote_file:
    description:
    - 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 I(remote_file) is C(4096).

Outputs

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