Skip to Main Content
Extending Puppet
book

Extending Puppet

by Alessandro Franceschi
June 2014
Intermediate to advanced content levelIntermediate to advanced
328 pages
7h 26m
English
Packt Publishing
Content preview from Extending Puppet

Using Hiera in Puppet

Using the Hiera functions, the data stored in Hiera can be retrieved by the Puppet Master while compiling the catalog. In our manifests, we can have something like the following:

$dns_servers = hiera("dns_servers")

Note that the name of the Puppet variable need not be the same as that of the Hiera one, so the previous code can also be as follows:

$my_dns_servers = hiera("dns_servers")

This assigns to the variable $my_dns_servers the top value (the first one found while crossing the hierarchy of data sources) retrieved by Hiera for the key dns_servers.

We can also merge arrays and hashes here; so in order to retrieve an array of all the values in the hierarchy's data sources of a given key and not just the first one, we can use ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Puppet

Mastering Puppet

Thomas Uphill
Learning Puppet

Learning Puppet

Chad Thompson
Pro Puppet

Pro Puppet

James Turnbull, Jeffrey McCune

Publisher Resources

ISBN: 9781783981441Supplemental Content