A more complete hierarchy

We are just handling simple hierarchies, so instead of programming a complex conditional statement in Puppet DSL to determine how a DNS resolver gets resolved, we can build a hierarchy that best represents our infrastructure, such as the following:

This example hierarchy would be represented with the following hiera.yaml:

---
version: 5
hierarchy:
- name: "Per-node data"
path: "nodes/%{trusted.certname}.yaml"

- name: "Per application data"
path: "%{facts.application}.yaml"

- name: "Per environment data"
path: "%{server_facts.environment}.yaml"

- name: "Per datacenter data"
path: "%{facts.datacenter}.yaml"

- name: "Common data"
path: common.yaml

The facts, trusted, and server_facts hashes are the most useful hashes to interpolate in hiera.yaml.

Note, if you need to reference the node's fqdn, use trusted.certname. In order to reference the environment of a node, the server_facts.environment fact is available.

See the Puppet documentation for more specifics on interpolation in Hiera: https://puppet.com/docs/puppet/5.3/hiera_merging.html#interpolation.

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

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