Apologies if this is an easy question, but I have limited experience with
Ansible, and I've been unable to find anything about this online. I've got
a codebase that looks like this:
# deploy.yml
---
- name: Get app name
hosts: localhost
vars_prompt:
- name: app
private: no
prompt: "App name"
tasks:
- set_fact:
app: "{{ app }}"
- name: "Setup {{ app }}"
hosts: localhost
roles:
- role: "app_roles/{{ app }}"
Everything works fine if I call the playbook with
ansible-playbook -e app=foo -i hosts deploy.yml
However, when I run it with
ansible-playbook -i hosts deploy.yml
it fails with this error, instead of prompting for the value of app
ERROR! 'app' is undefined
It looks like there's two problems here:
- The play name attribute contains "{{ app }}"
- The role name contains "{{ app }}"
The play name containing "{{ app }}" is nice but not necessary. The way
it's currently architected requires the role to be dynamic, though. That
leaves me with two questions:
- Is there some solution for using vars_prompt in this manner?
- Is there a better architecture for this?
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/ab8cd7e0-86f8-4012-9e11-f5045c7f23b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.