ce_command – Run arbitrary command on HUAWEI CloudEngine devices¶
Synopsis¶
- Sends an arbitrary command to an HUAWEI CloudEngine node and returns the results read from the device. The ce_command module includes an argument that will cause the module to wait for a specific condition before returning or timing out if the condition is not met.
Parameters¶
Notes¶
Note
- Recommended connection is network_cli.
- This module also works with localconnections for legacy playbooks.
Examples¶
# Note: examples below use the following provider dict to handle
#       transport and authentication to the node.
- name: CloudEngine command 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: "Run display version on remote devices"
    ce_command:
      commands: display version
      provider: "{{ cli }}"
  - name: "Run display version and check to see if output contains HUAWEI"
    ce_command:
      commands: display version
      wait_for: result[0] contains HUAWEI
      provider: "{{ cli }}"
  - name: "Run multiple commands on remote nodes"
    ce_command:
      commands:
        - display version
        - display device
      provider: "{{ cli }}"
  - name: "Run multiple commands and evaluate the output"
    ce_command:
      commands:
        - display version
        - display device
      wait_for:
        - result[0] contains HUAWEI
        - result[1] contains Device
      provider: "{{ cli }}"
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Status¶
- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Community. [community]
Authors¶
- JackyGao2016 (@CloudEngine-Ansible)
Hint
If you notice any issues in this documentation, you can edit this document to improve it.
