Skip to content

Instantly share code, notes, and snippets.

Created April 17, 2013 14:21
Show Gist options
  • Save anonymous/5404681 to your computer and use it in GitHub Desktop.
Save anonymous/5404681 to your computer and use it in GitHub Desktop.
/etc/puppet/hiera.yaml
---
:backends:
- yaml
:hierarchy:
- %{clientcert}
- %{environment}
- common
:yaml:
# datadir is empty here, so hiera uses its defaults:
# - /var/lib/hiera on *nix
# - %CommonAppData%\PuppetLabs\hiera\var on Windows
# When specifying a datadir, make sure the directory exists.
#:datadir: /etc/puppet/hieradata
:datadir: /etc/puppet/environments/%{environment}/hieradata
/etc/puppet/environments/sas/hieradata/common.yaml
accounts::users::accounts:
abc:
ensure: present
home: /home/abc
shell: /bin/bash
uid: 10001
gid: 10001
accounts::users::groups:
group1:
ensure: present
gid: 10000
/etc/puppet/environments/sas/modules/accounts/manifests/init.pp
class accounts::users (
$accounts,
$groups,
)
{
create_resources(user, $accounts)
create_resources(group, $groups)
}
class accounts {
include accounts::users
}
/etc/puppet/environments/sas/manifests/site.pp
import "accounts"
logs:
Apr 17 14:15:31 londtestscript01 puppet-agent[25570]: Local environment: "production" doesn't match server specified node environment "sas", switching agent to "sas".
Apr 17 14:15:33 londtestscript01 puppet-agent[25570]: Finished catalog run in 0.05 seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment