Debugging Hiera lookups
As you can see from the preceding example, the data that contributes to the complete configuration of any module can be rather dispersed throughout the set of your data sources. It can be challenging to determine where the respective values are retrieved from for any given agent node. It can be frustrating to trace data sources to find out why a change at some level will not take effect for some of your agents.
To help make the process more transparent, Hiera comes with a command-line tool called hiera
. Invoking it is simple:
root@puppetmaster # hiera -c /etc/puppetlabs/code/hiera.yaml demo::atoms
It retrieves a given key using the specified configuration from hiera.yaml
. Make sure that you use the same Hiera configuration as Puppet.
Of course, this can only work sensibly if Hiera selects the same data sources as the compiler, which uses fact values to form a concrete hierarchy. These required facts can be given right on the command line as the final parameters:
root...