John Gillis
09/10/2025, 6:25 PMJohn Gillis
09/10/2025, 6:25 PMnode /^app\d+/ {
include hosts
include firewall
}
with the hosts.pp looking like:
class hosts {
host { 'app01':
ip => 'x.x.x.x'
}
...
and the firewall something like:
class firewall {
package { ['iptables-services']:
ensure => installed
}
package { ['firewalld']:
ensure => absent
}
firewall { '200 allow Service':
source => 'app01',
dport => 'xxx',
proto => 'tcp',
action => 'accept'
}
...John Gillis
09/10/2025, 6:26 PMJohn Gillis
09/10/2025, 6:26 PMbastelfreak
09/10/2025, 6:28 PMClass['hosts'] -> Class['firewall'] looks correct (notice the single quotes)bastelfreak
09/10/2025, 6:29 PMbastelfreak
09/10/2025, 6:29 PMbastelfreak
09/10/2025, 6:29 PMJohn Gillis
09/10/2025, 6:30 PMbastelfreak
09/10/2025, 6:30 PMbastelfreak
09/10/2025, 6:30 PMJohn Gillis
09/10/2025, 6:31 PMJohn Gillis
09/10/2025, 6:31 PMJohn Gillis
09/10/2025, 6:33 PMbastelfreak
09/10/2025, 6:35 PMrequire hosts in the firewall classJohn Gillis
09/10/2025, 6:36 PMJohn Gillis
09/10/2025, 6:48 PMclass firewall::init {
Class['hosts'] -> Class['firewall::init']
require Class['hosts']
require hostsbastelfreak
09/10/2025, 6:49 PMJohn Gillis
09/10/2025, 6:50 PMJohn Gillis
09/10/2025, 6:50 PMbastelfreak
09/10/2025, 6:51 PMJohn Gillis
09/10/2025, 6:55 PMInfo: Using environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Notice: Requesting catalog from puppet:8140 (x.x.x.x)
Notice: Catalog compiled by puppet
Error: Failed to apply catalog: Parameter source failed on Firewall[007 allow monitoring SNMP]: Munging failed for value "new-server" in class source: host_to_ip failed for new-server, exception Failed to resolve hostname new-server (file: /etc/puppetlabs/code/environments/production/manifests/classes/firewall.pp, line: 49)
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping runbastelfreak
09/10/2025, 8:02 PMbastelfreak
09/10/2025, 8:02 PMbastelfreak
09/10/2025, 8:02 PMJohn Gillis
09/10/2025, 8:03 PMJohn Gillis
09/10/2025, 8:05 PMbastelfreak
09/10/2025, 8:07 PMbastelfreak
09/10/2025, 8:07 PMbastelfreak
09/10/2025, 8:07 PMbastelfreak
09/10/2025, 8:07 PMbastelfreak
09/10/2025, 8:07 PMJohn Gillis
09/10/2025, 8:07 PMbastelfreak
09/10/2025, 8:07 PMbastelfreak
09/10/2025, 8:08 PMbastelfreak
09/10/2025, 8:08 PMbastelfreak
09/10/2025, 8:08 PMbastelfreak
09/10/2025, 8:09 PMbastelfreak
09/10/2025, 8:09 PMbastelfreak
09/10/2025, 8:12 PMJohn Gillis
09/10/2025, 8:12 PMJohn Gillis
09/10/2025, 8:12 PMbastelfreak
09/10/2025, 8:13 PMJohn Gillis
09/10/2025, 8:14 PMcsharpsteen
09/10/2025, 8:15 PMcontain() might help if these are grouped up in a profile class.John Gillis
09/10/2025, 9:04 PMclass firewall {
contain firewall::init
}
is that what you were talking about?bastelfreak
09/10/2025, 9:06 PMJohn Gillis
09/10/2025, 9:10 PMJohn Gillis
09/10/2025, 9:12 PM/manifests/classes/firewall/init.pp
/manifests/classes/firewall/db.pp
/manifests/classes/firewall/staging/db.pp
...bastelfreak
09/10/2025, 9:13 PMbastelfreak
09/10/2025, 9:13 PMJohn Gillis
09/10/2025, 9:14 PM