Skip to content

Instantly share code, notes, and snippets.

@kesor
Last active December 19, 2015 00:09
Show Gist options
  • Save kesor/5866683 to your computer and use it in GitHub Desktop.
Save kesor/5866683 to your computer and use it in GitHub Desktop.
# /etc/puppet/config/client.yaml
---
client: example.com
environment: vagrant
# /etc/puppet/hiera.yaml -- global hiera configuration
---
:backends: - yaml
:hierarchy:
# global client setting, this file is ignored in git
# sets the client=someone variable, and possibly environment=something
- client
- clients/%{client}
- clients/%{client}/environments/%{environment}
- global/roles
- global
:yaml:
:datadir: /etc/puppet/config/hiera
node default {
# discover host role and include its classes
$roles = hiera_hash('roles')
$hosts = hiera_hash('hosts')
include $roles['base']
include $roles[ $hosts[$fqdn]['role'] ]
}
# /etc/puppet/config/hiera/global/roles.yaml
---
# classes for each role
# syntax:
#
# role_name:
# - class_name_1
# - class_name_2
# - ...
#
roles:
puppetserver:
# empty
graphite:
- graphite
- collectd
- collectd::server
# /etc/puppet/config/clients/example.com/environments/vagrant.yaml
---
roles:
custom_role_name:
- custom_class1
- custom_class2
hosts:
puppet.vagrant:
role: puppetserver
graphite.vagrant:
role: graphite
custom.vagrant:
role: custom_role_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment