Quantcast
Channel: Ask Puppet: Puppet DevOps Q&A Community - RSS feed
Viewing all articles
Browse latest Browse all 6104

Hiera hash into a template

$
0
0
Heya I have the following: a_cluster : - a : bob p : 51 - a : mike p : 52 ...... the question is i need to extrapolate these values into a template to produce seperated pairs. it needs to appear in the template like this: A String of Stuff : bob:51,mike:52,..and so on for however many occurances there are of the a/p pairs in the array. Would i need to do a bit of embedded ruby in the template? I was doing something like this in the erb template: <%- [@a_cluster].flatten.compact.each do |cluster| -%> A string of stuff <%= cluster['a'] %>:<%= cluster['p'] -%> but that just produces in the template: A string of stuff bob:51 A string of stuff mike:52 but i want all pairs on the same line, sperated by the ':' character.... cannot seem to fathom it. also as an aside in my travels i think i'm seeing some best practise notes which say "do this sort of stuff in the manifests, not in the templates" so should i be doing this in the manifests? Thanks for reading Gilbo.

Viewing all articles
Browse latest Browse all 6104

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>