External facter json array iteration inside puppet template

255 views
Skip to first unread message

Malintha Adikari

unread,
Jun 19, 2014, 3:50:12 AM6/19/14
to puppet...@googlegroups.com

I am sending data from puppet agent to master node using external facts. Here I use json array in my facters/facts.d/myData.json file.

"employees":[
{"firstName":"John", "lastName":"Doe"},
{"firstName":"Anna", "lastName":"Smith"},
{"firstName":"Peter", "lastName":"Jones"}
]

In master side I have a template. There I want to iterate this external fact json array.  Can I do this thing inside puppet template ? How Can I iterate this array ? I tried following but failed
<% @employees.each do |firstname| -%>
malintha
<% end -%>


 

Regards,

Malintha

Felix Frank

unread,
Jun 19, 2014, 6:29:55 AM6/19/14
to puppet...@googlegroups.com
There's a couple of issues with that, see
http://stackoverflow.com/questions/24301360/puppet-external-facter-json-array-iteration-inside-puppet-template

Does this facilitate cross posting already? ;/
Reply all
Reply to author
Forward
0 new messages