/pillar/test/init.sls
portal:
users:
testdude:
mainmail:
- test@mail.com
secondmail:
flags:
- flag1
- flag2
- flag3
anotherdude:
mainmail:
- mail1@abc.net
- secondmail@abc.net
secondmail:
flags:
- flag1
- flag2
- flag3
anotheruser3:
mainmail:
- john@hotmail.net
- george@hotmail.net
- helen@hotmail.net
secondmail:
flags:
- flag1
- flag2
- flag3
test.cfg:
emails= {% for portal, data in salt['pillar.get']('portal:users').items() %} {% for mail in data.mainmail %}{{ mail }},{% endfor %}{% endfor %}
state/test/init.sls
test_config:
file.managed:
- name: /root/test.cfg
- source: salt://test/test.cfg
- template: jinja
results:
cat /root/test.cfg
emails= mail1@abc.net,secondmail@abc.net, test@mail.com, john@hotmail.net,george@hotmail.net,helen@hotmail.net,
As you can see from results, if a "key" contains more than one value then the values are returned as array. Is it possible to get the items as seperate result in order to manipulate-use them.