Without hiera you have all those extra classes you posted below
including this very specific one. I think your classes are too
complicated to begin with regardless of where the data is, but the lack
of data separation probably sent you down that path.
class role::zabbix20::server::dc1 {
include profile::zabbix20::server::dc1
}
With Hiera this is enough
include role::zabbix
You're now thinking, "How do I specify this machine is a server, in dc1,
and installing zabbix 2?" To answer we will start over and try to build
what you have with Hiera. This is a little hard to deal with in email,
but I think you'll get the idea.
node zabbixserver {
# this is a top level role for the zabbix server
include role::zabbix
}
class role::zabbix {
include profile::base
include profile::zabbixserver
}
class profile::zabbixserver {
include profile::apache
include zabbix
}
class zabbix(
$bind_ip = 127.0.0.1,
$version = present,
) {
blah blah
}
This Hiera config assumes you have a dc and role fact of some sort. This
may or may not be easy in your environment.
hiera.yaml
---
:hierarchy:
- %{fqdn}
- %{dc}
- %{role}
- %{environment}
- common
This is our role data
./hieradata/common.yaml
---
zabbix::version: '2.0'
zabbix::bind_ip: '1.1.1.1'
These are the dc bits of data
./hieradata/dc1.yaml
---
zabbix::bind_ip: '1.2.3.1'
./hieradata/dc1.yaml
---
zabbix::bind_ip: '1.4.5.1'
Your parametrized class will autolookup matching parameters from Hiera
in Puppet 3.x or you can specify them manually. Machines in dc1 get
1.2.3.1, dc2 gets 1.4.5.1, and any machine gets 1.1.1.1.
In summary we move data into Hiera and replace module::someclass::dc
with a simple module that does a lookup to a data file based on facts
that have classified the node.
Ramin
> <
http://www.craigdunn.org/2012/05/239/>) and use hiera to