community.network.ce_command – Run arbitrary command on HUAWEI CloudEngine devices.¶
Note
This plugin is part of the community.network collection (version 1.3.2).
To install it use: ansible-galaxy collection install community.network
.
To use it in a playbook, specify: community.network.ce_command
.
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
local
connections 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"
community.network.ce_command:
commands: display version
provider: "{{ cli }}"
- name: "Run display version and check to see if output contains HUAWEI"
community.network.ce_command:
commands: display version
wait_for: result[0] contains HUAWEI
provider: "{{ cli }}"
- name: "Run multiple commands on remote nodes"
community.network.ce_command:
commands:
- display version
- display device
provider: "{{ cli }}"
- name: "Run multiple commands and evaluate the output"
community.network.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:
Authors¶
JackyGao2016 (@CloudEngine-Ansible)