I had to use this 

{% set my_port = item.value.get(nginx_dir).port %}

Regards,
Vikas

On Wednesday, 7 October 2015 13:40:34 UTC+11, Vikas Kumar wrote:
>
> Hello Everyone,
>
> I am trying to iterate over a dictionary in a Jinja2 template (in 
> Ansible). One of the arrays or keys in the dictionary is 'abcd'
> This works fine, but key 'abcd' varies in each dictionary.
> {{ item.value.abcd.port }}
>
>
> I am looking to do something like below using a variable 'nginx_dir'.
> {% set nginx_dir = item.value.keys().1 %}
> {% set my_port = item.value.nginx_dir.port %}
>
> Regards,
> Vikas
>
>

-- 
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/3b258e0f-ecd4-47b1-82e4-e533f2d60b1e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to