Skip to content

Commit

Permalink
Update firewall.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
lpwoodhouse committed Oct 14, 2022
1 parent e4335bc commit 98b7433
Showing 1 changed file with 27 additions and 17 deletions.
44 changes: 27 additions & 17 deletions tasks/firewall.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,35 @@
---
- name: enable ports in firewalld
firewalld:
port: "{{ item }}/tcp"
permanent: true
state: enabled
immediate: true
loop:
- "{{ zbx_passive_port }}"
- "{{ zbx_active_port }}"
- block:
- name: enable ports in firewalld
firewalld:
port: "{{ item }}/tcp"
permanent: true
state: enabled
immediate: true
loop:
- "{{ zbx_passive_port }}"
- "{{ zbx_active_port }}"

- command: firewall-cmd --list-all
register: firewalld_status
- debug: msg={{ firewalld_status }}

when:
- "'firewalld' in ansible_facts.packages"
- ansible_facts.services['firewalld']['state'] == 'running'

- name: allow ports in ufw
shell: |
'ufw allow in {{ zbx_passive_port }}/tcp' \
'ufw allow out {{ zbx_active_port }}/tcp'
- block:
- name: allow ports in ufw
command: "{{ item }}"
loop:
- 'ufw allow in {{ zbx_passive_port }}/tcp'
- 'ufw allow out {{ zbx_active_port }}/tcp'

- shell: ufw status verbose
register: ufw_status
- debug: msg={{ ufw_status }}

when:
- "'ufw' in ansible_facts.packages"
- ansible_facts.services['ufw']['state'] == 'running'

- shell: ufw status
regist: ufw_status
- debug: msg={{ ufw_status }}

0 comments on commit 98b7433

Please sign in to comment.