Hello,
I'm using puppet 3 with roles (mostly), profiles, and Hiera. I have a profile setup (for pdxcat/collectd) to, amongst other things, hiera_array() for values [of localports] to pass on to collectd::plugin::tcpconns. Defining everything in hiera files works as expected. However, I would like to add to those values from other profiles. But I haven't been able to get that working. Any suggestions?
Thanks
Kimo
hiera.yaml (condensed):
---
:hierarchy:
- roles/%{role}
- common
hiera/roles/app-db.yaml:
---
classes:
- profiles::postgresql::server
# This works as expected:
# profiles::collectd::tcpconns_localports:
# - 5432
hiera/common.yaml:
---
classes:
- profiles::collectd
profiles::collectd::tcpconns_localports:
- 22
profiles/manifests/collectd.pp:
class profiles::collectd {
# This is an array lookup so multiple hiera files can add ports to watch.
$tcpconns_localports = hiera_array('profiles::collectd::tcpconns_localports')
$tcpconns_remoteports = hiera_array('profiles::collectd::tcpconns_remoteports')
# NOTE: If you need to pass "false" onto the collectd config make sure to
# quote the false (foo => 'false') as some templates only do a simple if
# statement (if @foo) which when foo is undef evaluates to false.
class { '::collectd':
purge => true,
purge_config => true,
recurse => true,
}
class { '::collectd::plugin::tcpconns':
listening => 'false',
localports => $tcpconns_localports,
remoteports => $tcpconns_remoteports,
}
}
profiles/manifests/postgresql/server.pp:
class profiles::postgresql::server {
class { '::postgresql::server': }
# I would like to be able to add this here so I don't have to remember to
# add it to every %{::role}.yaml which includes this class.
# $::profiles::collectd::tcpconns_localports += [ '5432' ]
}