|
|
@ -26,11 +26,10 @@ description:
|
|
|
|
options:
|
|
|
|
options:
|
|
|
|
commands:
|
|
|
|
commands:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- The commands to send to the remote NXOS device over the
|
|
|
|
- The commands to send to the remote NXOS device. The resulting
|
|
|
|
configured provider. The resulting output from the command
|
|
|
|
output from the command is returned. If the I(wait_for)
|
|
|
|
is returned. If the I(wait_for) argument is provided, the
|
|
|
|
argument is provided, the module is not returned until the
|
|
|
|
module is not returned until the condition is satisfied or
|
|
|
|
condition is satisfied or the number of retires as expired.
|
|
|
|
the number of retires as expired.
|
|
|
|
|
|
|
|
- The I(commands) argument also accepts an alternative form
|
|
|
|
- The I(commands) argument also accepts an alternative form
|
|
|
|
that allows for complex values that specify the command
|
|
|
|
that allows for complex values that specify the command
|
|
|
|
to run and the output format to return. This can be done
|
|
|
|
to run and the output format to return. This can be done
|
|
|
@ -79,34 +78,21 @@ options:
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
EXAMPLES = """
|
|
|
|
EXAMPLES = """
|
|
|
|
# Note: examples below use the following provider dict to handle
|
|
|
|
|
|
|
|
# transport and authentication to the node.
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
vars:
|
|
|
|
|
|
|
|
cli:
|
|
|
|
|
|
|
|
host: "{{ inventory_hostname }}"
|
|
|
|
|
|
|
|
username: admin
|
|
|
|
|
|
|
|
password: admin
|
|
|
|
|
|
|
|
transport: cli
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
---
|
|
|
|
- name: run show version on remote devices
|
|
|
|
- name: run show version on remote devices
|
|
|
|
nxos_command:
|
|
|
|
nxos_command:
|
|
|
|
commands: show version
|
|
|
|
commands: show version
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: run show version and check to see if output contains Cisco
|
|
|
|
- name: run show version and check to see if output contains Cisco
|
|
|
|
nxos_command:
|
|
|
|
nxos_command:
|
|
|
|
commands: show version
|
|
|
|
commands: show version
|
|
|
|
wait_for: result[0] contains Cisco
|
|
|
|
wait_for: result[0] contains Cisco
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: run multiple commands on remote nodes
|
|
|
|
- name: run multiple commands on remote nodes
|
|
|
|
nxos_command:
|
|
|
|
nxos_command:
|
|
|
|
commands:
|
|
|
|
commands:
|
|
|
|
- show version
|
|
|
|
- show version
|
|
|
|
- show interfaces
|
|
|
|
- show interfaces
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: run multiple commands and evaluate the output
|
|
|
|
- name: run multiple commands and evaluate the output
|
|
|
|
nxos_command:
|
|
|
|
nxos_command:
|
|
|
@ -116,14 +102,12 @@ vars:
|
|
|
|
wait_for:
|
|
|
|
wait_for:
|
|
|
|
- result[0] contains Cisco
|
|
|
|
- result[0] contains Cisco
|
|
|
|
- result[1] contains loopback0
|
|
|
|
- result[1] contains loopback0
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: run commands and specify the output format
|
|
|
|
- name: run commands and specify the output format
|
|
|
|
nxos_command:
|
|
|
|
nxos_command:
|
|
|
|
commands:
|
|
|
|
commands:
|
|
|
|
- command: show version
|
|
|
|
- command: show version
|
|
|
|
output: json
|
|
|
|
output: json
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
RETURN = """
|
|
|
|
RETURN = """
|
|
|
|