fetching all targets from inventory inside jinja2 template

Skip to first unread message

Pranav Gupta

Mar 12, 2019, 5:07:57 PM3/12/19
to kapitan-discuss
Hi all,

When we access parameters using inventory inside templates, say like inventory.parameters.target then it will give us that specific target (say dev)  which is currently being compiled by Kapitan but if suppose I want to fetch other target names as well (like staging, prod) to populate some part of my template then how can I achieve this ? 

I simply tried looping over target inside jinja2 template but I think its not a list of targets so it doesn't work.


Pawel Sarbinowski

Mar 13, 2019, 5:39:26 AM3/13/19
to Pranav Gupta, kapitan-discuss
You can get the global inventory with 
{% set inventory_global = global %}

in jinja2. Output that in your file with 

{{ global | yaml }} to see the full contents. 

You received this message because you are subscribed to the Google Groups "kapitan-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kapitan-discu...@googlegroups.com.
To post to this group, send email to kapitan...@googlegroups.com.
Visit this group at https://groups.google.com/group/kapitan-discuss.
To view this discussion on the web visit https://groups.google.com/d/msgid/kapitan-discuss/f14f0ca0-0f4e-4af8-98e0-f3c278cb7eb1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Pawel Sarbinowski | DevOps Engineer | paw...@google.com 

Pranav Gupta

Mar 15, 2019, 8:59:06 AM3/15/19
to kapitan-discuss
Thanks Pawel
Reply all
Reply to author
0 new messages