# checking firewall form

**URL:** <https://forum.ansible.com/t/checking-firewall-form/30772>\
**Category:** Ansible Project\
**Created:** [July 12, 2019, 3:17pm UTC](https://forum.ansible.com/t/checking-firewall-form/30772 "2019-07-12T15:17:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Annam\_Rafi1](https://avatars.discourse-cdn.com/v4/letter/a/e79b87/32.png) [@Annam\_Rafi1](https://forum.ansible.com/u/Annam_Rafi1)\
**Post date:** [July 12, 2019, 3:17pm UTC](https://forum.ansible.com/t/checking-firewall-form/30772/1 "2019-07-12T15:17:29Z")

</div>

Hi,

I want to check to see if the firewall is running, if its running I want to add the syslog port. If the firewall is not on, i would like to skip the step.

I know i can use the when module but Im stumbling. Can you guys lmk what approach to take?

Thanks!!

---

<div class="post-metadata">

**Author:** ![S\_C\_Rigler](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@S\_C\_Rigler](https://forum.ansible.com/u/S_C_Rigler)\
**Post date:** [July 12, 2019, 3:20pm UTC](https://forum.ansible.com/t/checking-firewall-form/30772/2 "2019-07-12T15:20:24Z")

</div>

Maybe like this:

- name: Check if firewall runningservice:  
name: firewalld  
state: started  
register: firewall\_running  
check\_mode: true

- name: Add syslog port to firewall  
…  
when: not firewall\_running is changed

---

<div class="post-metadata">

**Author:** ![Annam\_Rafi1](https://avatars.discourse-cdn.com/v4/letter/a/e79b87/32.png) [@Annam\_Rafi1](https://forum.ansible.com/u/Annam_Rafi1)\
**Post date:** [July 12, 2019, 6:04pm UTC](https://forum.ansible.com/t/checking-firewall-form/30772/3 "2019-07-12T18:04:59Z")

</div>

Don’t I need conditions as well?

Thank you,

Annam Rafi
