Hi,
Have question whether is possible (ansible 1.4.2 >) setup prompt for volue for variable in variable is not defined.
For example:
First run of playbook:
variable is not defined
ask for value
task write value of variable to some ansible vars file
… Do other tasks…
Next run of playbook:
variable is read from ansible vars file
no prompt for value
… Do other tasks …
Tried find this in ansible help, but so far no luck.
Best regards,
Marcin Praczko
There’s no mechanism for this.
vars_prompt always prompts for the variable.
adam2
January 28, 2014, 5:25pm
3
The following is pseudo code, parts of it may not be entirely correct.
But the real trick is to use when.
Serkan_C
(Serkan C.)
September 10, 2014, 8:59am
4
Hi Micheal,
Do you have any advice for it? It doesn’t accept when condition.
Best.
As politely as possible… Please don’t share made-up syntax on this list, it confuses everyone
Nope, it doesn’t do this. Simple as that
I’d suggest setting a role default instead, or putting a good default value in group_vars/all, and you can override that on the CLI with “-e”.
vars_prompt in Ansible is not usually a good idea as it limits the ability of someone to automate a workflow in Ansible, since it’s interactive.
Serkan_C
(Serkan C.)
September 12, 2014, 10:45am
7
Hi,
You’re right, i was using default variables and extra parameters to override but i thought that maybe i can also use it for basic system playbooks.
Thanks.