public
Last active

Using Hiera for subnet based decisions in puppet 3.0.x

  • Download Gist
192.168.1.0.yaml
YAML
1 2 3 4 5 6 7 8 9
# in /etc/puppet/hieradata/
---
someclass::setting1: 'blah'
someclass::another_setting: 1234
someclass::array_setting:
- 'oneval'
- 'twoval'
- 'redval'
- 'blueval'
hiera.yaml
YAML
1 2 3 4 5 6 7 8 9 10
---
:hierarchy:
- %{network_eth0}
- common
 
:backends:
- yaml
 
:yaml:
:datadir: '/etc/puppet/hieradata'
someclass.pp
Puppet
1 2 3 4 5 6 7 8
class someclass(
$setting1 = 'sane_default',
$another_setting = 'also sane default',
$array_setting = [],
) {
 
#puppet code using those variables...
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.