Adding Hiera data to your Puppet repo
Let's add some example Hiera data to your Puppet repo and see what we can do with it. The following steps will take you through this process:
Run the following commands to install your per-environment Hiera config file:
cd /etc/puppetlabs/code/environments/production sudo cp /vagrant/examples/hiera_minimal.config.yaml hiera.yaml
Create your data directory for the data files to live in:
sudo mkdir data
Run the following command to install the example Hiera data file in your
data
directory (make sure you copy it exactly as shown; the file needs to end up namedcommon.yaml
):sudo cp /vagrant/examples/hiera_sample.yaml data/common.yaml
You've configured Hiera and added some data, so let's test your setup by looking up the Hiera data within a Puppet manifest. Run the following command:
sudo puppet apply -e "notice(lookup('test'))" Notice: Scope(Class[main]): This is a test
Troubleshooting Hiera
If you don't get the result This is a test
, your Hiera setup is...