community.network.cnos_command – Run arbitrary commands on Lenovo CNOS 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.cnos_command
.
Synopsis¶
Sends arbitrary commands to an CNOS node and returns the results read from the device. The
cnos_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¶
Examples¶
---
- name: Test contains operator
community.network.cnos_command:
commands:
- show version
- show system memory
wait_for:
- "result[0] contains 'Lenovo'"
- "result[1] contains 'MemFree'"
register: result
- ansible.builtin.assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- name: Get output for single command
community.network.cnos_command:
commands: ['show version']
register: result
- ansible.builtin.assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- name: Get output for multiple commands
community.network.cnos_command:
commands:
- show version
- show interface information
register: result
- ansible.builtin.assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- "result.stdout | length == 2"
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Authors¶
Anil Kumar Muraleedharan (@amuraleedhar)