Handling Data with Puppet
This chapter will focus on how to handle data using Puppet. It will look at Hiera, Puppet’s key-value data lookup tool, and how it ensures that Puppet’s reusable code is made more configurable without burdening it with excessive logic and variables. The basic structure of Hiera will be reviewed, showing how it stores data in hierarchies that provide a rules-based key lookup without a lot of fuss and how it can look up keys in this data to return values using different backends, which are implementations such as YAML files of data or API calls to applications. The use of automatic parameter lookup will be discussed showing how this allows the parameterized profiles to receive data automatically and how the lookup function can be used in Puppet code directly to call data. We will briefly discuss the changes between Hiera 3 and Hiera 5 in terms of legacy Puppet. Then, the three Hiera layers will be reviewed in detail (the global, environment, and...