Richard Crowley
2011-Feb-03 16:17 UTC
[Puppet Users] Exported resources and the tag function
Should I be able to use the built-in tag function... define nagios::host($hostgroups) { tag "environment:$environment" nagios_host { "$name": address => "$ipaddress_eth0", contact_groups => "ops", hostgroups => $hostgroups, notify => Service["nagios"], require => File["/etc/nagios/hosts"], target => "/etc/nagios/hosts/$name.cfg", use => "generic-host", } } ...with the goal of exporting @@nagios::host resources and collecting them by tag? node default {} node a inherits default { @@nagios::host { "$hostname": hostgroups => ["admin"] } } node b inherits default { Nagios::Host<<| tag == "environment:$environment" |>> } This example code does not work unless I add a tag parameter to the @@nagios::host resource in node a. The other alternative is to call the tag function in a node but it seems the tag is not inherited so rather than defining the tag in the default node, I''d have to do so in every node. The lack of inheritance seems to be by design so I''m fine using a define if I can get it to work. I am led to believe by http://projects.puppetlabs.com/issues/5239 that using a tag is the accepted workaround to not being able to collect by environment directly. Thanks, Richard -- 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 http://groups.google.com/group/puppet-users?hl=en.
Richard Crowley
2011-Feb-03 20:14 UTC
[Puppet Users] Re: Exported resources and the tag function
The other alternative is to call the tag function in a node but it seems the tag is not inherited so rather than defining the tag in the default node, I''d have to do so in every node. The lack of inheritance seems to be by design so I''m fine using a define if I can get it to work.> > I am led to believe by http://projects.puppetlabs.com/issues/5239 that using a tag is the accepted workaround to not being able to collect by environment directly.The tag function works in the global scope and it appears to not cause problems when clients with a different environment contact the same master. That''s my solution unless someone advises against it. -- 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 http://groups.google.com/group/puppet-users?hl=en.