Handling hashes and arrays

Some examples in this chapter defined array values in Hiera. The good news is that retrieving arrays and hashes from Hiera is not at all different from retrieving simple strings, numbers, or Boolean values. The hiera function will return all these values, which are ready for use in the manifest.

There are two more functions that offer special handling for such values; the hiera_array and hiera_hash functions.

The presence of these functions can be somewhat confusing. New users might assume that these are required whenever retrieving hashes or arrays from the hierarchy. When inheriting Puppet code, it can be a good idea to double-check that these derived functions are actually used correctly in a given context.

Get Puppet 5 Essentials - Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.