Thanks everyone for your feedback. I have been testing with puppetdb and stored configs and its working great. Below is an example using two different ways. The first one is using the collection syntax suggested by Jared and the other is using the puppet-puppetdb module as suggested by Luke. This gives me a lot of flexibility!
class core::nodes::dbclient {
@@iptables { "Allow db access to ${::hostname}":
proto => 'tcp',
source => $::ipaddress,
jump => 'ACCEPT',
tag => 'db::client'
}
}
class core::nodes::dbserver {
Iptables <<| tag == 'db::client' |>>
}
class core::nodes::appclient {
}
class core::nodes::appserver {
$clients = pdbresourcequery(["and",["=",["node","active"],true],["and",["=","type","Class"],["=","title","Core::Nodes::Appclient"]]], 'certname')
iptables { "allow web":
proto => 'tcp',
dport => '80',
source => $clients,
jump => 'ACCEPT'
}
}
So if I had the following node definitions, then appserver1 would have rules built to allow port 80 and port 3306 from appclient1.
node 'appclient1' {
include core::nodes::dbclient
include core::nodes::appclient
}
node 'appserver1' {
include core::nodes::dbserver
include core::nodes::appserver
}
Thanks for your input and I hope this follow-up helps someone else in the future.
Take care.