Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Puppet 5

You're reading from   Mastering Puppet 5 Optimize enterprise-grade environment performance with Puppet

Arrow left icon
Product type Paperback
Published in Sep 2018
Publisher Packt
ISBN-13 9781788831864
Length 292 pages
Edition 1st Edition
Tools
Arrow right icon
Authors (2):
Arrow left icon
Jason Southgate Jason Southgate
Author Profile Icon Jason Southgate
Jason Southgate
Ryan Russell-Yates Ryan Russell-Yates
Author Profile Icon Ryan Russell-Yates
Ryan Russell-Yates
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Authoring Modules FREE CHAPTER 2. Roles and Profiles 3. Extending Puppet 4. Hiera 5 5. Managing Code 6. Workflow 7. Continuous Integration 8. Extending Puppet with Tasks and Discovery 9. Exported Resources 10. Application Orchestration 11. Scaling Puppet 12. Troubleshooting and Profiling 13. Other Books You May Enjoy

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.

Note

See...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime