ios_command: Correct answer example and consolidate docs on command param. (#40158)

* Correct answer example as 'c' cancels, not confirms. Moved command note to be in line with command docs.

* Correct example to escape square brackets. Remove '\r' mention as it does not get passed correctly.

* Add carriage return example since it works with double quotes.

* Remove colon which was breaking docs rendering.
This commit is contained in:
Tyler Bigler 2018-05-16 10:39:07 -04:00 committed by John R Barker
parent f60731e27e
commit db4ae20e8b

View file

@ -37,8 +37,6 @@ description:
extends_documentation_fragment: ios extends_documentation_fragment: ios
notes: notes:
- Tested against IOS 15.6 - Tested against IOS 15.6
- If a command sent to the device requires answering a prompt, it is possible
to pass a dict containing I(command), I(answer) and I(prompt). See examples.
options: options:
commands: commands:
description: description:
@ -46,7 +44,11 @@ options:
configured provider. The resulting output from the command configured provider. The resulting output from the command
is returned. If the I(wait_for) argument is provided, the is returned. If the I(wait_for) argument is provided, the
module is not returned until the condition is satisfied or module is not returned until the condition is satisfied or
the number of retries has expired. the number of retries has expired. If a command sent to the
device requires answering a prompt, it is possible to pass
a dict containing I(command), I(answer) and I(prompt).
Common answers are 'y' or "\\r" (carriage return, must be
double quotes). See examples.
required: true required: true
wait_for: wait_for:
description: description:
@ -84,7 +86,7 @@ options:
default: 1 default: 1
""" """
EXAMPLES = """ EXAMPLES = r"""
tasks: tasks:
- name: run show version on remote devices - name: run show version on remote devices
ios_command: ios_command:
@ -109,12 +111,15 @@ tasks:
wait_for: wait_for:
- result[0] contains IOS - result[0] contains IOS
- result[1] contains Loopback0 - result[1] contains Loopback0
- name: run command that requires answering a prompt - name: run commands that require answering a prompt
ios_command: ios_command:
commands: commands:
- command: 'clear counters GigabitEthernet0/1'
prompt: 'Clear "show interface" counters on this interface \[confirm\]'
answer: 'y'
- command: 'clear counters GigabitEthernet0/2' - command: 'clear counters GigabitEthernet0/2'
prompt: 'Clear "show interface" counters on this interface [confirm]' prompt: '[confirm]'
answer: c answer: "\r"
""" """
RETURN = """ RETURN = """