This message was deleted.
# puppet-enterprise
s
This message was deleted.
m
class caiso_unix_firewalld { package { 'firewalld': ensure => present, } service { 'firewalld': ensure => running, enable => true, } file { '/etc/firewalld/zones': ensure => directory, owner => 'root', group => 'root', mode => '0750', } }
class caiso_unix_firewalld::nrpe { require caiso_unix_firewalld $zonefile = $facts['caiso_environment'] ? { 'caiso_dev' => 'nrpe_zone.dev', default => 'nrpe_zone.prod', } file { '/etc/firewalld/zones/CAISO-nrpe.xml': ensure => file, owner => 'root', group => 'root', mode => '0640', source => "puppet:///modules/caiso_unix_firewalld/${zonefile}", notify => Service['firewalld'], } }
Error: Found 1 dependency cycle: (File[/etc/firewalld/zones/CAISO-nrpe.xml] => Service[firewalld] => Class[Caiso_unix_firewalld] => Class[Caiso_unix_firewalld::Nrpe] => File[/etc/firewalld/zones/CAISO-nrpe.xml])\nTry the '--graph' option and opening the resulting '.dot' file in OmniGraffle or GraphViz Error: Failed to apply catalog: One or more resource dependency cycles detected in graph
b
a) there's a firewalld module, I highly recommend using that instead of reinventing the wheel
b) in
caiso_unix_firewalld::nrpe
you require caiso_unix_firewalld but also send a notify to a service in that class. that doesn't work
I don't see why the
require
is requried. just drop that
https://github.com/voxpupuli/puppet-firewalld I recommend that, if you need to use firewalld
m
require is so that the package & service is there
b
no. require means that the package and service is defined before caiso_unix_firewalld::nrpe. that doesn't make sense in your usecase
you can switch to
include
if you like
👍 1
then it will float through the catalog
m
yea, now that you mention that, include would be better
c
Yup,
require caiso_unix_firewalld
means all resources declared in
caiso_unix_firewalld
have to be synced before any resources in
caiso_unix_firewalld::nrpe
. So anything in
caiso_unix_firewalld::nrpe
that tries to move before something in
caiso_unix_firewalld
, like
notify => Service['firewalld']
, is going to be a circular dependency.
m
I was looking at the firewalld module, and had started with a rich rule, rather than a zone. first time dealing with firewalld/nftables in rhel9, other admins preferred defining in zones rather than rich rules
ahhh, thanks for the explanation there @csharpsteen
c
include caiso_unix_firewalld
just ensures the compiler has evaluated that class so that things like
Service['firewalld']
are available to form dependencies against.
m
re: firewalld, so needed a bit more time to figure out the module, when I have a couple dev/test hosts that "need it now"
thanks everyone