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?

If the below text isn't displaying properly I've also created a 
gist: https://gist.github.com/kimor79/b0cdd99cb98c01892049

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' ]
  }

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/36bee2ea-3560-4429-a517-918d69d1a53e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to