-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e4335bc
commit 98b7433
Showing
1 changed file
with
27 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} | ||
|