Importing configuration data with Hiera
A key principle of good programming is to separate data and code. Many Puppet manifests are full of site-specific data that makes it hard to share and re-use the manifests. Grouping all such data into structured text files and moving it outside the Puppet manifests makes it easier to maintain, as well as easier to re-use and share code with other people.
Ideally, we'd not only be able to look up configuration parameters from a data file, but also choose a different data file depending on things like the environment, the operating system, and other facts about the machine. We'd also like to be able to organize the data hierarchically so that we can override certain values with other, higher-priority values.
Puppet has a mechanism named Hiera (as in 'hierarchy') to do just this. The hiera
function lets you look up configuration data from within your manifest, and Hiera takes care of returning the correct value for the current environment.