Puppet setup firewall rules task failed

@Inderpreet Yes… it was assigned today.

Thank you.

@Inderpreet as discussed, can you please mark it for pending

@salilpune1 its Pending for you now.

Hey @andrescaroc
what was the issue with this class function?

class firewall_node1 {
firewalld_port { ‘Open port 6000 in the public zone’:
ensure => present,
zone => ‘public’,
port => 6000,
protocol => ‘tcp’,
}
}

I am getting similar behaviours what you got before. puppet agent get the config applied with success, but there has been no change on the ports in public zone? how did you overcome that issue?

I’m also investigating this behavior.
I think it has to do with firewalld not reloading after manifest is deployed.
After pulling the manifest on Agent, try with firewall-cmd --reload and see if the port is now opened.

1 Like

@gustavos86 that did the trick. solved the issue with firewall-cmd --reload
thank you very much.

@nashwan I’m glad this tip helped.

This is mentioned among the lines in the doc shared by @andrzej https://forge.puppet.com/puppet/firewalld/readme
However, It’s not 100% clear to me the advise given there about this topic. If someone can help me to clarify it, I’d be good.

I was looking into Firewalld not reloading in 3.0 · Issue #38 · voxpupuli/puppet-firewalld · GitHub. I found out that adding include firewalld inside the classes, at the beginning of each also works to solve this.

Hello @nashwan

The class function does not have issue, what I learned from docs is that you must declare the class { 'firewalld': } specified in the usage section, this way:

class { 'firewalld': }

class firewall_node1 {
  firewalld_port { 'Open port 6400 in the public zone':
    ensure   => present,
    zone     => 'public',
    port     => 6400,
    protocol => 'tcp',
  }
}

I hope this helps for everybody that is stuck with this task.

For sure, I think the documentation of this module could be better with an example of that “usage” statement within a code example, but this is what we have.

Regards

2 Likes

@andrescaroc thank you very much mate. I managed to solve the task without
class { ‘firewalld’: }

but I had to reload the firewall list port with firewall-cmd --reload
thanks a lot @andrescaroc and @gustavos86

Thanks @andrescaroc, that’s exactly what I was looking for.

Hi All,
Could you please check and advise here.
image
as per the above error message, one of the blogs mentioned I have to include the below code snippet in my code.


I have added that towards the end of my code. is that correct? or should I include it in the beginning or at a different place?
also, class { ‘firewalld’: } am I supposed to declare it three times, or declaring it once is sufficient?
#separate pp file for firewall rules

separate pp file for node specification

image
I have attached my codes here. Please advise.
thanks

@andrzej @Inderpreet @andrescaroc @antonysavio1111
please check and advise.

Hi All,
one of you please check and advise.

Thank you!
@Inderpreet @gustavos86 @Tej-Singh-Rana @nashwan @ramnamy @andrescaroc @andrzej @Devops @antonysavio1111 @mouador


blog.pp

data.pp

as per this note.


should I also use Hiera example too in my blog.pp?

@swaroopcs88

blog.pp has some errors.
Hint: remove class { 'firewalld': }

And include it in data.pp

hey @Devops
getting this message now.


data.pp
image
media.pp

any hints here?

@swaroopcs88

You did it in Wrong way. Module firewalld is already installed and you need to include it.

hey sorry, not understanding how to implement that change.
thanks

hi all, please check and advise.
thanks

not sure how to include these changes to my code.
please advise. thank you

@swaroopcs88, please make sure to check puppet services on both master and agent if running. Please make sure to install puppet firewall module puppet/firewalld. As per your screenshot please remove the highlighted code.

Really struggling on my task, everything works on my side but can’t get the task validated :

Here is the test :