Retrieving and using Hiera values in manifests
Looking up a key value in Hiera is easy. Puppet comes with a very straightforward function for this:
$plugins = hiera('reporting::plugins')
Whenever the compiler encounters such a call in the manifest of the current agent node, it triggers a search in the hierarchy. The specific data sources are determined by the hierarchy in your
hiera.yaml file. It will almost always rely on fact values provided by the agent to make flexible data source selections.
If the named key cannot be found in the agent's hierarchy, the master aborts the catalog compilation with an error. To prevent this, it is often sensible to supply a default value with the lookup:
$plugins = hiera('reporting::plugins', )
In this case, Puppet ...