I was about to open an issue that the prompt to vars_prompt did not
interpolate my variables. Then, after doing a couple more tests, I
realised it is because vars_prompt runs very early, before even setup
does.
Is there something like vars_prompt that runs in the middle of a play,
with access to variables? This is my scenario:
1. Play runs, and through its run it creates a var with the name of a
database it's going to delete.
2. User gets prompted something like vars_prompt: db2: "I'm about to
delete {{db1}}. Enter the db's full name to confirm"
3. The play only deletes the database when: db1 == db2.
Here are my questions:
1. Can I do what I want with the current ansible modules/lookup plugins?
2. What would be the sane thing to add to ansible so the above
workflow is possible?
3. At which point should this conversation move to -devel?
Thanks,
Javier
Last question first: probably now
Regarding the other 2, it would seem that running the data gathered during the vars_prompt through the template engine might be the best/easiest solution, though we can continue to discuss it on -devel.
And, answering myself: in discussion with drybjed and bbhoss, this is
a possible solution:
Add the vars_prompt: type of lookup to the pause module, so pause has
both prompt: for yes/no, and vars_prompt: for strings input at the
keyboard.
J
Have you looked into the pause module? It is what I use for confirming.
Brian Coca
We were discussing the pause module on IRC. We don't want to risk
people confirming by mistake with a simple <enter>; we want users to
type out the databse to wipe out. Also pause doesn't pause for every
host: there are rolling updates in which it pauses per group of hosts.
Maybe we need another module that requests user input per individual host.
J
Hi all,
We all ended up bringing this discussion over to ansible-devel.
If you are interested, try joining there:
https://groups.google.com/forum/#!forum/ansible-devel