- Overview
- Module Description - What the module does and why it is useful
- Setup - The basics of getting started with hiera
- Usage - Configuration options and additional functionality
- Reference - An under-the-hood peek at what the module is doing and how
- Limitations - OS compatibility, etc.
- Development - Guide for contributing to the module
This module configures Hiera for Puppet.
- Hiera yaml file
- Hiera datadir
- hiera-eyaml package
- keys/ directory for eyaml
- /etc/hiera.yaml for symlink
If you are using Puppet Enterprise and the eyaml backend, you will need the puppetlabs-pe_gem module to install the eyaml gem using PE's gem command.
Otherwise you just need puppet.
Declaring the class with a given hierarchy is a pretty good starting point:
This class will write out a hiera.yaml file in either /etc/puppetlabs/puppet/hiera.yaml or /etc/puppet/hiera.yaml (depending on if the node is running Puppet Enterprise or not).
class { 'hiera':
hierarchy => [
'%{environment}/%{calling_class}',
'%{environment}',
'common',
],
}
The resulting output in /etc/puppet/hiera.yaml:
---
:backends:
- yaml
:logger: console
:hierarchy:
- "%{environment}/%{calling_class}"
- "%{environment}"
- common
:yaml:
:datadir: /etc/puppet/hieradata
This module will also allow you to configure different options for logger and merge_behaviour. The default behaviour is to set logger to console and merge behaviour to native.
For details and valid options [Configuring Hiera][https://docs.puppetlabs.com/hiera/1/configuring.html#global-settings].
Note: For merge_behavior
if you set deep or deeper you need to ensure the deep_merge Ruby gem is installed.
class { 'hiera':
hierarchy => [
'%{environment}/%{calling_class}',
'%{environment}',
'common',
],
logger => 'console',
merge_behavior => 'deep'
}
The resulting output in /etc/puppet/hiera.yaml:
---
:backends:
- yaml
:logger: console
:hierarchy:
- "%{environment}/%{calling_class}"
- "%{environment}"
- common
:yaml:
:datadir: /etc/puppet/hieradata
:merge_behavior: deep
- hiera: Main class to configure hiera
- hiera::params: Handles variable conditionals
- hiera::eyaml: Handles eyaml configuration
The following parameters are available for the hiera class:
Configures the hiera hierarchy. Default is []
Configures the list of backends. Default is ['yaml']
Configures the path to hiera.yaml
Configures the path to the hieradata directory.
Enables/disables the datadir file resource
Sets the owner of the managed files and directories.
Sets the group of the managed files and directories.
Enables/disables the eyaml backend. Default true
Configures the eyaml data directory. Default is the same as datadir
Configures the eyaml file extension. No default
Configures the directory for puppet's confdir.
Configures the hiera logger. Default is 'console'
Configures the hiera merge behavior (e.g. for deep merges). No default
Accepts arbitrary content to add to the end of hiera.yaml
Unknown.
Pull requests on github! If someone wrote spec tests, that would be awesome.