Just to add/explain more. The jinja2 template with create an yaml with two stanzas per host, with first stanza containing first value of var1 n var2
And second stanza with second value of var1 n var2. So entire yaml generated in this way will have two stanza per host --- yamlinput: - Stanza1 - stanza2 Etc On Feb 19, 2019 11:02 PM, <[email protected]> wrote: my inventory file is like below with more additional group_vars and host_vars that I havent mentioned here for simplicity: I dont want to use host_vars as of now. [qa] host1 var1='["hi" , "xy"]' var2=[435345, 3425634] host1 var2='["asd" , "er"]' var2=[212, 456] host1 var3='["zxc" , "ghhj"]' var2=[567, 80] host1 var4='["hi" , "hhj"]' var2=[435, 980] Im trying to create a yml file out of this via jinja2 --- yamlinput: - {{% for host in groups['qa'] %}} host: {{ host }} params: {{% for i,j in zip(var1,var2) %}} --> Im not sure how to achieve something like this in jinja2. Can someone please guide? app: {{ i } port: {{ j }} -- 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/7198676d-a907-4b81-af69-85a75628cafa%40googlegroups. com <https://groups.google.com/d/msgid/ansible-project/7198676d-a907-4b81-af69-85a75628cafa%40googlegroups.com?utm_medium=email&utm_source=footer> . For more options, visit https://groups.google.com/d/optout. -- 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/CABNWynCU8ibyx2M%3DTBn1e8SwJpG1tqiWEe%3DQCkGuruuMtzCWBw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
