Created
May 1, 2013 12:04
-
-
Save benagricola/5494926 to your computer and use it in GitHub Desktop.
Profiles and Roles with Hiera / Puppet 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
:backends: | |
- yaml | |
- gpg | |
:gpg: | |
:datadir: '/etc/puppet/hiera' | |
:yaml: | |
:datadir: '/etc/puppet/hiera' | |
:logger: console | |
:hierarchy: | |
- nodes/%{::clientcert}-%{calling_module} | |
- role/%{calling_class} | |
- profile/%{calling_class} | |
- common/%{calling_module} | |
- common/common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class profile { | |
$roles = hiera_array('profile::roles',[]) | |
include $roles | |
} | |
class profile::puppetmaster inherits profile {} | |
class profile::dedicated-db inherits profile {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
roles: | |
- puppetmaster | |
- puppetdb | |
- webserver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class role { | |
$classes = hiera_array('role::classes',[]) | |
include $classes | |
} | |
class role::puppetmaster inherits role {} | |
class role::puppetdb inherits role {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
role::classes: | |
- puppet::db | |
- postgresql | |
- psql_tools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node default { | |
include $::profile | |
} |
Did you try module_name
?
I had better luck with it than calling_class
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't know if it's a bug with the version of Puppet ( 3.7.1 ) or Hiera ( 1.3.4 ) that I'm using, but
calling_class
doesn't seem to be working properly.For example, when I set up manifests and hiera similar to what you've got here, and I assign the role 'role::puppetmaster' to a node, Hiera pulls the data from
roles/role.yaml
, notroles/role::puppetmaster.yaml
. It seems likecalling_class
is the class where the hiera_* call is made, not the subclass.