Pavel Loginov 2020-04-08 18:56:51 +02:00
parent 4d71d0d1f8
commit 8d211f487d
3 changed files with 14 additions and 6 deletions

View File

@ -148,7 +148,7 @@
ignore_errors: yes ignore_errors: yes
no_log: True no_log: True
debugger: never debugger: never
when: ansible_facts.services["firewalld.service"]['state'] == "running" when: (ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS') and ansible_facts.services["firewalld.service"]['state'] == "running"
with_items: [ "{{ STAT_PORT }}", "{{ SOCK_PORT }}" ] with_items: [ "{{ STAT_PORT }}", "{{ SOCK_PORT }}" ]

View File

@ -7,6 +7,11 @@
ansible_port: "{{SSH_PORT}}" ansible_port: "{{SSH_PORT}}"
- name: collect facts about system services
service_facts:
register: services_state
- name: Open stat port for firewalld - name: Open stat port for firewalld
firewalld: firewalld:
port: "9101/tcp" port: "9101/tcp"
@ -22,7 +27,7 @@
- name: Open stat port for iptables - name: Open stat port for iptables
iptables: iptables:
chain: INPUT chain: INPUT
destination_port: 9101 destination_port: "9101"
jump: ACCEPT jump: ACCEPT
protocol: tcp protocol: tcp
ignore_errors: yes ignore_errors: yes

View File

@ -7,6 +7,11 @@
ansible_port: "{{SSH_PORT}}" ansible_port: "{{SSH_PORT}}"
- name: collect facts about system services
service_facts:
register: services_state
- name: Open stat port for firewalld - name: Open stat port for firewalld
firewalld: firewalld:
port: "9113/tcp" port: "9113/tcp"
@ -14,15 +19,13 @@
permanent: yes permanent: yes
immediate: yes immediate: yes
ignore_errors: yes ignore_errors: yes
no_log: True
debugger: never
when: (ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS') and ansible_facts.services["firewalld.service"]['state'] == "running" when: (ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS') and ansible_facts.services["firewalld.service"]['state'] == "running"
- name: Open stat port for iptables - name: Open stat port for iptables
iptables: iptables:
chain: INPUT chain: INPUT
destination_port: 9113 destination_port: "9113"
jump: ACCEPT jump: ACCEPT
protocol: tcp protocol: tcp
ignore_errors: yes ignore_errors: yes