Expose newline option to cli_command module (#55451)

* Add newline to all cliconf plugins

* Expose newline in cli_command

* Also hook up to anything using transform_commands directly
This commit is contained in:
Nathaniel Case 2019-05-07 17:25:57 -04:00 committed by GitHub
parent 8ff27c4e0c
commit 38890ddcaf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 67 additions and 53 deletions

View file

@ -46,6 +46,14 @@ options:
type: bool
default: false
required: false
newline:
description:
- The boolean value, that when set to false will send I(answer) to the
device without a trailing newline.
type: bool
default: true
required: false
version_added: 2.9
check_all:
description:
- By default if any one of the prompts mentioned in C(prompt) option is matched it won't check
@ -71,6 +79,13 @@ EXAMPLES = """
prompt: This commit will replace or remove the entire running configuration
answer: yes
- name: run command expecting user confirmation
cli_command:
command: show interface summary
prompt: Press any key to continue
answer: y
newline: false
- name: run config mode command and handle prompt/answer
cli_command:
command: "{{ item }}"
@ -129,6 +144,7 @@ def main():
command=dict(type='str', required=True),
prompt=dict(type='list', required=False),
answer=dict(type='list', required=False),
newline=dict(type='bool', default=True, required=False),
sendonly=dict(type='bool', default=False, required=False),
check_all=dict(type='bool', default=False, required=False),
)