Found this issue https://github.com/ansible/ansible/issues/15753 "Accessing 
a dictionary using {{ vars['dictname'] }} doesn't interpolate variables in 
the dictionary elements" that is very close to mine.

Still no work-around.


On Wednesday, April 19, 2017 at 12:48:54 PM UTC-4, Long Vu wrote:
>
> Hi,
>
> In a template, I use "{{ vars[varname] }}".  "varname" is a default var 
> declared this way "varname: {{ another_var }}".
>
> I would expect in the template to get the value of another_var, not the 
> name of another_var.
>
> I have reproduced the problem in test/integration/targets/var_blending at 
> this gist https://gist.github.com/tlvu/ade0a36dc426eea4b9f6a28381cc1fc1 
> (runme.sh pass).
>
> I am using version 2.3.0.0 (stable-2.3 c92765e26e).
>
> The real usecase for this is I'd like to do something like {{ vars[prefix 
> + '_token'] }} in a template and prefix would be declared as "prefix: {{ 
> prod_prefix }}" or "prefix: {{ staging_prefix }}" depending on the 
> inventory file used.  I think this usecase is immensely useful so I was a 
> bit surprised it did not work.
>
> If there is an existing bug, please point me to it.  I did search for 
> "recursive vars expansion" and did not find anything useful.
>
> If there is any work-around, please let me know because I am pretty stuck 
> right now.
>
> Thanks,
> Long
>

-- 

This email or any attachments may contain confidential or legally 
privileged information intended for the sole use of the addressees. Any 
use, redistribution, disclosure, or reproduction of this information, 
except as intended, is prohibited. If you received this email in error, 
please notify the sender and remove all copies of the message, including 
any attachments.

-- 
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/f5e62257-600b-40f2-ba3f-c3934edd5c94%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to