I'm dabbling with Puppet to update an arbitrary list of appsettings in an ASP.NET web.config (for deployment purpose) and I'm in a dilemma, mostly because I'm a real n00b in puppet.
I have this yaml file (hiera)
---
appSettings:
setting1: "hello"
setting2: "world!"
setting3: "lalala"
the number of setting[x] can span arbitrarily (one appSetting) and I would like to loop through the hash keys/value to update the corresponding appSetting/add in the web.config (using exec with powershell) the problem is i've searched high and low on how to iterate on keys and values.
I came across create_resources and this of course iterates through a hash of hash with a pre-determined set of keys. again, the key names are not known within the manifest (hence iterating the key/value pairs).
any guidance is appreciated.
Edit: looks like there is a keys() function i can use over the hash and iterate over that then use hiera_hash('appSettings') to get the hash and iterate through the values.
execwith a slightly more powerful script to do the job of all your current execs and apply all the key/value pairs. You'd likely need an additional script to determine if there is work to do on the target file, to form youronlyifcondition. - Depending on how important performance is, this may be nitpicking - Felix Frank