I have Vagrant set up and it's using Puppet as the provisioner with Puppet scripts setting up MySQL, PHP, etc. but the Puppet scripts have the hard coded values for passwords, addresses, etc.
I'd like to pull those out and store them in a external file alongside the Vagrantfile (not nested in the Puppet folder).
I thought this is what Hiera was for but cannot make sense of the documentation when trying to solve my problem. Any sugggestions?
I find that this worked example is a pretty good primer on how to use Hiera with Puppet for node specific configuration.
The above example basically has you go from a
sites.pp
file that looks like:To one that simply defines a list of nodes:
The config is then inherited depending on the hierarchy defined in
hiera.yaml
. In their example they simply use this:Which says to load any YAML config files under
/etc/puppet/hieradata/node/%{::fqdn}.yaml
(for example,/etc/puppet/hieradata/node/kermit.example.com.yaml
) and where needed config options aren't found in this first step then to pull any remaining config data in from/etc/puppet/hieradata/common.yaml
.The YAML files themselves are then defined like:
kermit.example.com.yaml:
common.yaml: