How to configure prompt with 2 inputs

268 views
Skip to first unread message

Srinivas Naram

unread,
Jan 10, 2020, 9:28:23 AM1/10/20
to Ansible Project
Hello Gurus

I am working on ios_command module. This modules facilitates in execute commands on Cisco IOS devices.

While running 'reload' command it is prompting for 2 inputs, 

    "System configuration has been modified. Save? [yes/no]" ----> yes
    "Proceed with reload? [confirm]   ----> return character here

I tried using prompts, but looks like it does not support providing answers for 2 questions in 1 command. Tried expect module (could not get this working)

Any suggestions?

My code snippet:

ios_command:
   commands
:
       
- command: 'reload'
         prompt
:
             
-  "System configuration has been modified. Save? [yes/no]"
             
-  "Proceed with reload? [confirm]
        answer:
           - "
\r"
           - 'yes'


      

Phil Griffiths

unread,
Jan 10, 2020, 11:54:48 AM1/10/20
to Ansible Project
try this?

---
- name: reboot ios device
  cli_command:
    command: reload
    prompt:
      - Save?
      - confirm
    answer:
     - y
     - y

Srinivas Naram

unread,
Jan 13, 2020, 3:51:48 AM1/13/20
to ansible...@googlegroups.com
Thanks for our reply Phil. It did not work though.

Any other suggestions ?

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/5f7e1ebb-3cd3-4fa4-9d15-7814a9597e23%40googlegroups.com.

Uriel

unread,
Jan 13, 2020, 11:24:56 AM1/13/20
to Ansible Project
I think the only thing missing from @Phil's answer is check_all: True


On Monday, January 13, 2020 at 2:51:48 AM UTC-6, Srinivas Naram wrote:
Thanks for our reply Phil. It did not work though.

Any other suggestions ?

To unsubscribe from this group and stop receiving emails from it, send an email to ansible...@googlegroups.com.

Srinivas Naram

unread,
Jan 14, 2020, 6:19:00 AM1/14/20
to ansible...@googlegroups.com
Thanks, that helped.

To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/58df3013-6a9a-4aff-8ff2-233d0fcca48b%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages