# Deploy a Firewall in Ansible

**URL:** <https://forum.ansible.com/t/deploy-a-firewall-in-ansible/36131>\
**Category:** Ansible Project\
**Created:** [December 19, 2021, 9:43pm UTC](https://forum.ansible.com/t/deploy-a-firewall-in-ansible/36131 "2021-12-19T21:43:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Liliana\_Achig](https://avatars.discourse-cdn.com/v4/letter/l/67e7ee/32.png) [@Liliana\_Achig](https://forum.ansible.com/u/Liliana_Achig)\
**Post date:** [December 19, 2021, 9:43pm UTC](https://forum.ansible.com/t/deploy-a-firewall-in-ansible/36131/1 "2021-12-19T21:43:16Z")

</div>

Please have a playbook template to deploy a Firewall in Ansible, there are not many on the internet, I have tried with them but they don’t work for me, not Ansible firewallD, I was trying with UFW but I have not had any results either. Please someone who can help me with this issue, I thank in advance whoever does it for help.

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [December 21, 2021, 10:39am UTC](https://forum.ansible.com/t/deploy-a-firewall-in-ansible/36131/2 "2021-12-21T10:39:13Z")

</div>

Sounds like ansible is totally irrelevant to you.

First pick a firewall that suits your requirements and only then look how to automate it.

---

<div class="post-metadata">

**Author:** ![Liliana\_Achig](https://avatars.discourse-cdn.com/v4/letter/l/67e7ee/32.png) [@Liliana\_Achig](https://forum.ansible.com/u/Liliana_Achig)\
**Post date:** [December 21, 2021, 9:21pm UTC](https://forum.ansible.com/t/deploy-a-firewall-in-ansible/36131/3 "2021-12-21T21:21:01Z")

</div>

Excuse me, I’m new to ansible. I don’t know if you can help me, how can I check that the port of the firewall that I implemented was blocked or the change was made in the host node, the playbook has already run but I need to know how to do the rest

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [December 22, 2021, 9:42am UTC](https://forum.ansible.com/t/deploy-a-firewall-in-ansible/36131/4 "2021-12-22T09:42:06Z")

</div>

> Excuse me, I'm new to ansible. I don't know if you can help me, how can I check that the port of the firewall that I implemented was blocked or the change was made in the host node, the playbook has already run but I need to know how to do the rest

It would be helpful to reveal your playbook.

Try nmap to check whether ports are open or not.

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<div class="post-metadata">

**Author:** ![Nico\_Kadel-Garcia](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/nico_kadel-garcia/32/9998_2.png) [@Nico\_Kadel-Garcia](https://forum.ansible.com/u/Nico_Kadel-Garcia)\
**Post date:** [December 22, 2021, 12:56pm UTC](https://forum.ansible.com/t/deploy-a-firewall-in-ansible/36131/5 "2021-12-22T12:56:29Z")

</div>

Or netcat, which is lighterweight and tends to upset security people less.

---

<div class="post-metadata">

**Author:** ![Mauricio\_Tavares](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Mauricio\_Tavares](https://forum.ansible.com/u/Mauricio_Tavares)\
**Post date:** [December 22, 2021, 1:12pm UTC](https://forum.ansible.com/t/deploy-a-firewall-in-ansible/36131/6 "2021-12-22T13:12:02Z")

</div>

> \>  
> \> \> Excuse me, I'm new to ansible. I don't know if you can help me, how can I check that the port of the firewall that I implemented was blocked or the change was made in the host node, the playbook has already run but I need to know how to do the rest  
> \>  
> \> It would be helpful to reveal your playbook.  
> \>  
> \> Try nmap to check whether ports are open or not.  
> \>  
> \> Regards  
> \> Racke
> 
> Or netcat, which is lighterweight and tends to upset security people less.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Another alternative is to use ansible to retrieve a list of the  
current firewall settings
