Iterate over complex dicitonary structure in j2 tempalte

66 views
Skip to first unread message

Hristo Stoyanov

unread,
Nov 13, 2015, 12:26:39 AM11/13/15
to Ansible Project
Sorry if this has been documented elsewhere (where?), but how can one iterate with jinja2 over a dictionary?


You can ask here or in stackoverflow.

Thanks

Alex Leonhardt

unread,
Nov 13, 2015, 1:45:48 AM11/13/15
to ansible...@googlegroups.com

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/28bc59f9-ff76-4c65-b6cc-44521f53cc03%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

gpg public key: http://dpaste.com/1CEJ38Z 

Hristo Stoyanov

unread,
Nov 13, 2015, 10:49:28 AM11/13/15
to ansible...@googlegroups.com

I saw those, but they do not apply to jinja2 templates.

/Hristo Stoyanov

You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/7ERrHwcRdWM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.

To post to this group, send email to ansible...@googlegroups.com.

Matt Martz

unread,
Nov 13, 2015, 11:29:44 AM11/13/15
to ansible...@googlegroups.com
The jinja2 templates documentation contains multiple examples of looping over dictionaries:


Using '.iteritems()', or '.items()' as well as using the '|dictsort' filter


For more options, visit https://groups.google.com/d/optout.



--
Matt Martz
@sivel
sivel.net
Reply all
Reply to author
Forward
0 new messages