I have a use case where I need to use a variable within a variable. I'm 
sure it's doable, but I'm new to Ansible syntax and tried different ways 
with no success.

Here's the scenario:

1) Playbook uses variable {{ redis_password.qa }} defined in /vars/main.yml:

---

redis_password:

  qa: qa123

  production: prod123

2) We're also passing a variable {{ app_env }} on the command line when 
running the Playbook:
--extra-vars "app_env=qa"

3) Now, I need to use the variable passed on command line to get the 
variable from /vars/main.yml:
{{ redis_password.{{ app_env }} }}

Any way to do 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/418e666c-8001-4e93-8040-9d190b8c435f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to