O'Reilly logo

Puppet Essentials by Felix Frank

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Hiera in different contexts

You will most likely find yourself in need of some data from Hiera when designing templates for configuration or other files. For example, when building your personal module in order to manage the SSH server, you might want to allow nodes to specify a list of environment variables for the AcceptEnv option.

Tip

Granted, this will most likely be passed as a parameter to a class within such a module. The Hiera data will just be bound to the parameter and be available to the template as a regular Puppet variable. Let's ignore this just to have a contrived example for data retrieval from a template.

The naïve implementation would not work inside the template:

<% # pseudo code! vars = hiera('ssh::server::env_vars', [ 'LANG', ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required