mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
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:
@@ -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),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user