diff --git a/changelogs/fragments/cli-command-module.yaml b/changelogs/fragments/cli-command-module.yaml new file mode 100644 index 000000000..5a5836f20 --- /dev/null +++ b/changelogs/fragments/cli-command-module.yaml @@ -0,0 +1,4 @@ +--- +doc_changes: + - Add a simple regexp match example for multiple prompt with multiple answers. + This example could be used to for restarting a network device with a delay. diff --git a/docs/ansible.netcommon.cli_command_module.rst b/docs/ansible.netcommon.cli_command_module.rst index 11bd0eb82..e5346740e 100644 --- a/docs/ansible.netcommon.cli_command_module.rst +++ b/docs/ansible.netcommon.cli_command_module.rst @@ -200,6 +200,17 @@ Examples - - y + - name: Simple regexp match for multiple prompt, multiple answer(mandatory check for all prompts) + ansible.netcommon.cli_command: + command: reload in 5 + check_all: true + prompt: + - Save\? + - confirm + answer: + - n + - y + Return Values diff --git a/plugins/modules/cli_command.py b/plugins/modules/cli_command.py index 7ad7bad91..8ef820635 100644 --- a/plugins/modules/cli_command.py +++ b/plugins/modules/cli_command.py @@ -111,6 +111,17 @@ - y - - y + +- name: Simple regexp match for multiple prompt, multiple answer(mandatory check for all prompts) + ansible.netcommon.cli_command: + command: reload in 5 + check_all: true + prompt: + - Save\\? + - confirm + answer: + - n + - y """ RETURN = """