Maybe like this:

- name: Check if firewall running
  service:
    name: firewalld
    state: started
  register: firewall_running
  check_mode: true

- name: Add syslog port to firewall
  ...
  when: not firewall_running is changed

On Fri, Jul 12, 2019 at 10:17 AM Anu R <[email protected]> wrote:

> 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!!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/9f33c7a7-7824-4ad1-8643-ac063e0f20ad%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/9f33c7a7-7824-4ad1-8643-ac063e0f20ad%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAFbiokfh7dD2YHPaUChVALCF%2B8gQquG_ktHY70GH6oQ%2B6r0NNA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to