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 to declare resources from the data.

When building and maintaining Puppet code bases, it is a good idea to implement the Roles and Profiles pattern. It makes you define roles to cover all of your machine use cases. The roles mix and match profile classes, which are basically collectors of classes from custom and open source modules that manage actual resources.

This concludes our tour of Puppet Essentials. We have covered quite some ground, but as you can imagine, we barely scratched the surface of some of the topics, such as provider development or exploiting PuppetDB. What you have learned will most likely satisfy your immediate requirements. For information beyond these lessons, don't hesitate to look up the excellent online documentation at https://docs.puppetlabs.com/, or join the community and ask your questions in chat or on the mailing list.

Thanks for reading, and have lots of fun with Puppet and its family of management tools.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset