Hi Dusty, On Tuesday, January 29, 2013 2:30:14 AM UTC, Dusty Doris wrote: > > I'd like to be able to collect all the hostnames (fqdn) or ips of certain > hosts to be used in setting up firewall rules. I'd like to search for > hosts that have included a particular class, perhaps by simply setting a > tag when that resource is included. > > eg: > > node 'node1' { > include 'somewebclass' > } > > class somewebclass { > tag 'web' > # other stuff > } > > > Then in another class, I'd like to find all my 'web' hosts and allow them > access in a firewall rule. > eg: > > class somedbclass { > tag 'db' > iptables { "allow db access": > proto => 'tcp', > dport => '3306' > source => Node <| tag == 'web' |>, > jump => 'ACCEPT' > } > } > > So, ultimately, I'd need that Node <| tag == 'web' |> to be an array of > hostnames or ipaddresses. > > This is just an example to try to explain what I am doing. Does anyone > know how to do this? Can I do this in puppet? Do I need to write my own > function to handle this? Or, can I use something like hiera or puppetdb to > do this? >
Native Puppet doesn't have any such feature. I asked a similar question in this thread about a month ago where I was trying bend Exported Resources to my will: https://groups.google.com/forum/?fromgroups=#!searchin/puppet-users/luke$20bigum$20exported/puppet-users/zQgUDx2ixus/XpGFOo6OwvQJ To save you some reading I would recommend using this module to pull raw data from PuppetDB, or something similar: https://github.com/dalen/puppet-puppetdbquery >From there you could build your hash/array, then use that in a template or to create individual Puppet resources from for your firewall rules. Hope that helps, -Luke -- 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 post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.