# How to write script for multiple prompts?

**URL:** <https://forum.ansible.com/t/how-to-write-script-for-multiple-prompts/34847>\
**Category:** Ansible Project\
**Created:** [March 24, 2021, 4:39pm UTC](https://forum.ansible.com/t/how-to-write-script-for-multiple-prompts/34847 "2021-03-24T16:39:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vikram\_S](https://avatars.discourse-cdn.com/v4/letter/v/90db22/32.png) [@Vikram\_S](https://forum.ansible.com/u/Vikram_S)\
**Post date:** [March 24, 2021, 4:39pm UTC](https://forum.ansible.com/t/how-to-write-script-for-multiple-prompts/34847/1 "2021-03-24T16:39:05Z")

</div>

Hi,

Below is the command i need executed as part of IOS upgrade activiity. As you can see, it involves 2 prompts. So how do i write a script using ios\_command module when multiple prompts are involved?

install add file flash:cat9k\_lite\_iosxe.16.12.01.SPA.bin activate commit

This operation requires a reload of the system. Do you want to proceed?

Please confirm you have changed boot config to flash:packages.conf [y/n]y

— Starting initial file syncing —

This operation requires a reload of the system. Do you want to proceed? [y/n]y

Will the below script work?

ios\_command:

commands:

command: install add file flash:cat9k\_lite\_iosxe.16.12.01.SPA.bin activate commit

prompt: ‘Do you want to proceed?’

answer: ‘y’

prompt: ‘Do you want to proceed?’

answer: ‘y’

---

<div class="post-metadata">

**Author:** ![Teofil\_Mihance](https://avatars.discourse-cdn.com/v4/letter/t/82dd89/32.png) [@Teofil\_Mihance](https://forum.ansible.com/u/Teofil_Mihance)\
**Post date:** [March 30, 2021, 10:43am UTC](https://forum.ansible.com/t/how-to-write-script-for-multiple-prompts/34847/2 "2021-03-30T10:43:43Z")

</div>

Hi,

I end up using shell scripts for these ios interaction. ios\_command and other modules are not handling in a right way the timeouts:  
For some new ios version this command in one shot and without interaction could be useful:  
install add file flash:cat9k\_lite\_iosxe.16.12.04.SPA.bin activate commit prompt-level none  
For old ios versions i created shell script for prompting also:
