-
Notifications
You must be signed in to change notification settings - Fork 23.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vars_prompt / include_vars_prompt for roles #7221
Comments
This is not going to be something we are likely to implement. vars_prompt is a feature in Ansible but it is not usable in a non-interactive capacity. Far better to use "-e @filename.yml" to supply inputs. I'm not sure what "include_vars_prompt" would be but we're definitely trying to control language keyword sprawl. |
Is it not possible to supply values for vars_prompt via -e flag as well which would support non-interactive running? A quick check of the code makes it appear that is the case. My hesitation to using -e with a separate file is that I then need to implement functionality to generate that file with a wrapper script for ansible-playbook which would also understand facts and group vars. It's doable, but seems like a kludge versus being able to simply prompt for things when they are needed. |
@nathanhruby I'm able to specify values for things in vars_prompt by using the -e flag and avoid having an interactive workflow. (using Ansible 1.8.1) |
Yeah, I ended up writing the wrapper script kludge and passed the values I needed via environment variables in the script, then used a chain of lookup() and default() calls in my role tasks to get the functionality I needed. I also switched jobs since I opened this bug and am doing a new ansible rollout. This would still be a handy feature, though, given the setup we will need I'll probably just end up wrappering the actual ansible-playbook call again. |
Issue Type:
Feature Idea
Ansible Version:
ansible 1.5.4
Environment:
N/A
Summary:
Related to #3245 I'd like to request the ability to use vars_prompt in a role, such as:
OR
My use case:
My deployment system uses a role to handle the actual deployment. Specifically, hosts are grouped in inventory into application groups, each group has a group_vars file that sets the required vars (git repos, pip files, application name, etc..) for the role to perform the deployment with.
Our main playbook then has a play for each application, targeted at the application group, that calls the deployment role.
What I would like to do now is easily add vars_prompt: functionality into the deployment role so that I may prompt the user for the desired release to deploy. For automated invocation, the release would need to be supplied as an extra var, which is fine.
Having this feature would allow me to avoid having to duplicate via copy-n-paste the vars_prompt bits for each application deployment play. Since I have multiple prompts per application and would like to use Jinja templates to define the prompt and default vars, the repetition of this code gets unwieldy quickly. Moreso when I end up needing to split applications up into separate playbooks.
Thanks!
-n
The text was updated successfully, but these errors were encountered: