This is a fully-featured Hiera example that can be executed with
The purpose of this project is to teach basic Hiera concepts - and has an
NOTE: DO NOT USE THE PRIVATE KEY IN THIS REPO FOR ANYTHING ELSE OTHER THAN DEMONSTRATION
What is Hiera?
Hiera is a hierarchical database that is mainly used with puppet - it allows the storage of common configuration data to further simplify your puppet setup - meaning easier recycling of your manifests and modules. Data can be stored in JSON or YAML, although the latter seems to be the one used more in examples (and the one used in this one).
You can find more info on Hiera here:
About hiera-eyaml (encrypted YAML)
hiera-eyaml is an excellent encryption add-on, and in fact one of the reasons that I started exploring Hiera in the first place (ie: to store sensitive data in puppet that should not be stored in plain text).
More info in how to work with eYAML files can be found in the companion article, but also you can check out the repo here:
Using this example
This project can be run entirely from userspace. Clone, change directories to to the project directory, and run:
FACTER_tldrnode=[dataset1|dataset2] puppet apply \ --hiera_config hiera.yaml --modulepath modules/ \ -e 'include tldr_hiera'
This will write another Markdown,
tldr_hiera_out.md, into the
Manipulating the passed in facter variable will change the output, demonstrating simple node configurations, which is pretty much what Hiera is built for:
- Node data files exist for both
- Any other setting (or omission of the FACTER_tldrnode varible) will cause the common values to be written.
If you found this example at all useful, feel free to email me at firstname.lastname@example.org.
Thanks and enjoy!