-
Notifications
You must be signed in to change notification settings - Fork 0
Puppet 4 :: Hiera
Vijaya Venu edited this page Jul 25, 2018
·
4 revisions
- Hiera helps to lookup data from data-source
- Separation of data and logic
- yaml :: YAML Ain't Markup Language
class motd ( $message = "Welcome to Git Wiki" )
{
file { '/etc/motd':
ensure => 'file',
content => $message,
}
}
- In Puppet 4 the configuration directory stores the hiera.yaml file and we can make use of the defaults found in the file.
- common.yaml
motd::message: "This is a dev system for developers only!" ## this will ensure that $message param of class motd uses this value
- The Hiera configuration file location
puppet config get hiera_config - Sample hira.yaml
--- ## start of doc
:backends: yaml ## scalar mapping
:hierarchy: ## sequence to find variable value
- param%{environment} ## sequence mapping. {environment} => top level variable. {facts.os.hostname} can be used
- common
:logger: console
:yaml:
:datadir: "%{settings::confdir}/configuration"
## Strings (can be unquoted - but quotes are recommended)
ntp::ntp_local_server: 192.168.0.3
ntp::ntp_local_server: '192.168.0.3'
## Boolean (yes, no, true, false, on, off)
ntp::monitor: false
## Arrays (Indents are important)
ntp::ntp_regional_server:
- 'server1'
- 'server2'
- true