Hiera

Hiera is great for the organization of the data that is used to deploy nodes. If you create a hierarchy that accurately describes your infrastructure, you can achieve great reductions in complexity. Debugging can be a pain, though. When debugging, you need to know the fact values that were used to retrieve the Hiera values. In this section, we'll work through an example of how a Hiera value can be changed, depending on the values returned by Facter.

For this example, we will configure Hiera with a custom hierarchy and then use the values from Facter on a node to perform lookups with the command-line Hiera tool:

  1. Configure Hiera with the following hierarchy in hiera.yaml:
    :hierarchy: - defaults - hosts/"%{hostname}" - environments/"%{environment}" ...

Get Troubleshooting Puppet now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.