Summary
Hiera is a tool that stores and retrieves data in a hierarchical fashion. Each retrieval uses a distinct data source from each hierarchy layer and traverses your hierarchy from the most to the least specific. The hierarchy is defined by the user, as an array in a YAML file.
Puppet has Hiera support built in, and you can use it to separate data from code. From manifests, you will mainly perform lookups through the hiera
function. The respective entries will rely on fact values in most cases.
Another common way to employ Hiera through Puppet is to name the Hiera keys in the <class-name>::<parameter-name>
format. When including a parameterized class, Puppet will look for such keys in Hiera. If the manifest does not supply a parameter value, Puppet automatically binds the value from Hiera to the respective parameter.
Manifests that boast large numbers of static resources can be cleaned up by converting the declarations to hashes and using the create_resources
or each
function...