See Getting Started with Hiera and in particular Using Hiera with Puppet.
On the master:
root@vhost1:~# apt-get install hiera
Still on the master, edit
/etc/puppet.hiera.yaml:
---
:backends:
- yaml
:logger: console
:yaml:
:datadir: /srv/puppet/common/hiera
:hierarchy:
- "%{environment}/%{calling_class}"
- "%{environment}/defaults"
- common
In /srv/puppet/common/hiera/common.yaml, put:
--- ntpserver: ntp0.xennet ntp::server: ntp0.xennet
E.g.
file { '/tmp/hieratest':
ensure => 'present',
content => hiera('ntpserver'),
}
On the client:
root@vhost2:~# puppet agent -t
root@vhost2:~# cat /tmp/hieratest
ntp0.xennet
To test a yaml file locally:
root@vhost1:~# hiera -c /etc/puppet/hiera.yaml ntpserver
ntp0.xennet
![]() | Warning |
|---|---|
|
Hiera uses different default paths to hiera.yaml, depending on whether it starts standalone or as a child of Puppet. |