[Puppet Users] Using facts from stored configs based on class

Grant Byers
Wed, 30 Nov 2011 09:22:53 -0000

Hi,

Is it possible to use facts from external nodes via stored configs, based
on a filter such as class? To illustrate, I provide the following use case ;


class nagios::nrpe {
  # No such resource "ip". I''d like to use "ip"
fact of any node that is
assigned to class "nagios::server"
  $nagios_servers = Ip <<| class="nagios::server" |>>

  # Construct firewall rule from template using knowledge of external hosts.
  ipt_fragment { "090nrpe_filter":
    table => "filter",
    content => template("nagios/nrpe.cfg.erb"),
  }

}

templates/nrpe.cfg.erb:
...
allowed_hosts=<%= nagios_servers.join('','') %>
...

I''m currently storing this type of data (nagios_servers) in CSV &
using
extlookup, but it seems to me that we should already know this information
if we''re using stored configs.


Thanks,
Grant

--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at