Question:
I am running an ansible-playbook
which have many tasks listed. All of them use to get run one by one, but I want to pause
the playbook after a particular tasks to asks the user if he wants to continue running the rest of the tasks or exit. I have seen the pause module
of ansible but couldn’t see any example which asks users for yes or no which in turn continue or exit the ansible-playbook accordingly.
Answer:
The pause
module actually does exactly that. But it does not give you an option to answer yes
or no
. Instead it expects the user to press Ctrl+C and then a for abort. To continue the user simply needs to press Enter.
Since this is not perfectly obvious to the user you can describe it in the prompt
parameter.
1 2 3 4 |
- name: Exterminate mankind pause: prompt: Please confirm you want to exterminate mankind! Press return to continue. Press Ctrl+c and then "a" to abort |