Hiera
Hiera is a key/value store to keep configuration parameters. It is hierichal allowing values to be set at different level affecting different number of hosts. Currently hiera is configured with the following levels:
- Fqdn - The top level, contains per host overrides.
- Host groups - Allows you to apply a configuration to several hosts.
- Domain - Allows setting values per domain. Useful in conjunction with the server naming convention, where servers with similar purpose should have the same domain.
- Common - Fallback values used by everyone else.
Lookup
The lookup
function uses Hiera to retrieve a value for a given key. See the official lookup documentation for usage.
The hiera
, hiera_array
, hiera_hash
, and hiera_include
functions are deprecated and should not be used any more.
Instead use the equivalent call to the lookup
function. See the "Updated classic Hiera function calls" section in the Hiera migration documentation for more details.
Useful hieradata keys
For all nodes
role
: Specifies which puppet role module to use for the given node/domain
For nodes inheriting the server role
accessgroups
: Which ldap groups are allowed to log in on this serversudogroups
: Which ldap groups have sudo access on this serversudousers
: Users that have sudo access on this servernameservers
: List of name servers to use on this hostsshd_pwlogin
: Whether or not to allow login using password authentication over ssh. Defaults to truesshd_rootlogin
: Whether or not to allow root login over ssh. Root user must still be part of a group in accessgroups. Defaults to truesshd_use_duo_twofactor
: Whether or not to enable Duo Security 2FA. Defaults to false
Hostgroups
If you wish to use the same configuration for multiple similar hosts you can use hostgroups.
Hostgroups are defined in hieradata/hostgroups
. To assign a hostgroup to a node you reference the hostgroup
in a node hiera data file.
Example where a Puppet Master node hiera data file reference the puppet.uninett.no
hostgroup:
$ cat nodes/vlarn076.oam.uninett.no.yaml
---
hostgroups:
- puppet.uninett.no
A node can have up to 3 hostgroups as defined in hiera.yaml
.