checking firewall form

21 views
Skip to first unread message

Anu R

unread,
Jul 12, 2019, 11:17:29 AM7/12/19
to Ansible Project
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!! 

S C Rigler

unread,
Jul 12, 2019, 11:20:51 AM7/12/19
to ansible...@googlegroups.com
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

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/9f33c7a7-7824-4ad1-8643-ac063e0f20ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Annam Rafi

unread,
Jul 12, 2019, 2:05:17 PM7/12/19
to ansible...@googlegroups.com
Don’t I need conditions as well?

Thank you,

Annam Rafi

Reply all
Reply to author
Forward
0 new messages