# How to get facts about firewall type?

**URL:** <https://forum.ansible.com/t/how-to-get-facts-about-firewall-type/21475>\
**Category:** Ansible Project\
**Created:** [May 18, 2016, 1:34pm UTC](https://forum.ansible.com/t/how-to-get-facts-about-firewall-type/21475 "2016-05-18T13:34:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![user15](https://avatars.discourse-cdn.com/v4/letter/u/d6d6ee/32.png) [@user15](https://forum.ansible.com/u/user15)\
**Post date:** [May 18, 2016, 1:34pm UTC](https://forum.ansible.com/t/how-to-get-facts-about-firewall-type/21475/1 "2016-05-18T13:34:32Z")

</div>

Hi,

I have a lot of centos7 webservers with firewalld onboard and a lot of centos7 webservers with iptables onboard and i need to write role webserves, some parts are differ to different firewall type.

Is a simple way to get fact about firewall presence (installed or not) and its type (firewalld/iptables) or i need to input this info manually into variables?

---

<div class="post-metadata">

**Author:** ![Matt\_Davis](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@Matt\_Davis](https://forum.ansible.com/u/Matt_Davis)\
**Post date:** [May 18, 2016, 10:44pm UTC](https://forum.ansible.com/t/how-to-get-facts-about-firewall-type/21475/2 "2016-05-18T22:44:47Z")

</div>

Doesn’t work that way today, but that sounds like an awesome enhancement to the facts module… #lowhangingfruit

---

<div class="post-metadata">

**Author:** ![Johannes\_Kastl](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@Johannes\_Kastl](https://forum.ansible.com/u/Johannes_Kastl)\
**Post date:** [May 19, 2016, 8:18am UTC](https://forum.ansible.com/t/how-to-get-facts-about-firewall-type/21475/3 "2016-05-19T08:18:49Z")

</div>

+1

But using a pre-task testing for /etc/firewalld, systemctl status  
firewalld or /etc/sysconfig/iptables-config should do the trick...

Johannes
