Book Image

Troubleshooting Puppet

By : Thomas Uphill
Book Image

Troubleshooting Puppet

By: Thomas Uphill

Overview of this book

Table of Contents (14 chapters)

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}"
      - architecture/"%{architecture}"
      - "%{operatingsystem}/%{operatingsystemrelease}"
      - global
  2. Create hieradata files in the architecture and operatingsystem directories with values that we can retrieve, as follows:

    1. Create a YAML file in...