Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add eos_command doc with more examples #36245

Merged
merged 2 commits into from
Feb 16, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 23 additions & 1 deletion lib/ansible/modules/network/eos/eos_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
and what conditionals to apply. This argument will cause
the task to wait for a particular conditional to be true
before moving forward. If the conditional is not true
by the configured retries, the task fails. See examples.
by the configured retries, the task fails.
Note - With I(wait_for) the value in C(result['stdout']) can be accessed
using C(result), that is to access C(result['stdout'][0]) use C(result[0]) See examples.
required: false
default: null
aliases: ['waitfor']
Expand Down Expand Up @@ -115,6 +117,26 @@
commands:
- command: show version
output: json

- name: using cli transport, check whether the switch is in maintenance mode
eos_command:
commands: show maintenance
wait_for: result[0] contains 'Under Maintenance'

- name: using cli transport, check whether the switch is in maintenance mode using json output
eos_command:
commands: show maintenance | json
wait_for: result[0].units.System.state eq 'underMaintenance'

- name: "using eapi transport check whether the switch is in maintenance,
with 8 retries and 2 second interval between retries"
eos_command:
commands: show maintenance
wait_for: result[0]['units']['System']['state'] eq 'underMaintenance'
interval: 2
retries: 8
provider:
transport: eapi
"""

RETURN = """
Expand Down