# Interactive prompt for one or more commands in a playbook

**URL:** <https://forum.ansible.com/t/interactive-prompt-for-one-or-more-commands-in-a-playbook/35584>\
**Category:** Ansible Project\
**Created:** [August 4, 2021, 9:43pm UTC](https://forum.ansible.com/t/interactive-prompt-for-one-or-more-commands-in-a-playbook/35584 "2021-08-04T21:43:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Josh\_Karki](https://avatars.discourse-cdn.com/v4/letter/j/77aa72/32.png) [@Josh\_Karki](https://forum.ansible.com/u/Josh_Karki)\
**Post date:** [August 4, 2021, 9:43pm UTC](https://forum.ansible.com/t/interactive-prompt-for-one-or-more-commands-in-a-playbook/35584/1 "2021-08-04T21:43:23Z")

</div>

For example,

show interface status  
show version  
show ip route

how can a module be written in Ansible to prompt user for the show command to type in when running a playbook. If entered one command (show interface status) and matched, print the output and ignore the rest other commands. If no match found, print default msg : “command not found” or something like that.

I am noob to Ansible.

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [August 5, 2021, 2:50pm UTC](https://forum.ansible.com/t/interactive-prompt-for-one-or-more-commands-in-a-playbook/35584/2 "2021-08-05T14:50:13Z")

</div>

I would use vars\_prompt and feed that data to the module or you can  
use the pause action  
([https://docs.ansible.com/ansible-core/2.11/collections/ansible/builtin/pause\_module.html](https://docs.ansible.com/ansible-core/2.11/collections/ansible/builtin/pause_module.html))

But a normal module cannot prompt the user, they are designed to be  
executed on the remote.

---

<div class="post-metadata">

**Author:** ![rolandm](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/rolandm/32/755_2.png) [@rolandm](https://forum.ansible.com/u/rolandm)\
**Post date:** [August 5, 2021, 9:47pm UTC](https://forum.ansible.com/t/interactive-prompt-for-one-or-more-commands-in-a-playbook/35584/3 "2021-08-05T21:47:11Z")

</div>

If you just want to execute task by task and press OK for continuing you could use the step mode by adding --step to the ansible-playbook command.

This way ansible-playbook will ask before every task to execute it (=y) skip it (=n) or continue without stepping (=c).

Perform task: configure ssh (y/n/c):

[https://docs.ansible.com/ansible/2.4/playbooks\_startnstep.html#step](https://docs.ansible.com/ansible/2.4/playbooks_startnstep.html#step)

$ ansible-playbook playbook.yml --step

However, - as Brian already pointed out - providing additional information during execution of the playbook is not supported.
