checking firewall form

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!!

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

Don’t I need conditions as well?

Thank you,

Annam Rafi