diff --git a/app/scripts/ansible/roles/haproxy/tasks/main.yml b/app/scripts/ansible/roles/haproxy/tasks/main.yml index 9d9f6537..9ffb8cd1 100644 --- a/app/scripts/ansible/roles/haproxy/tasks/main.yml +++ b/app/scripts/ansible/roles/haproxy/tasks/main.yml @@ -148,7 +148,7 @@ ignore_errors: yes no_log: True 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 }}" ] diff --git a/app/scripts/ansible/roles/haproxy_exporter.yml b/app/scripts/ansible/roles/haproxy_exporter.yml index d08f495e..03b8e0a1 100644 --- a/app/scripts/ansible/roles/haproxy_exporter.yml +++ b/app/scripts/ansible/roles/haproxy_exporter.yml @@ -7,6 +7,11 @@ ansible_port: "{{SSH_PORT}}" + - name: collect facts about system services + service_facts: + register: services_state + + - name: Open stat port for firewalld firewalld: port: "9101/tcp" @@ -22,7 +27,7 @@ - name: Open stat port for iptables iptables: chain: INPUT - destination_port: 9101 + destination_port: "9101" jump: ACCEPT protocol: tcp ignore_errors: yes diff --git a/app/scripts/ansible/roles/nginx_exporter.yml b/app/scripts/ansible/roles/nginx_exporter.yml index 75ea5acf..ba04aa7b 100644 --- a/app/scripts/ansible/roles/nginx_exporter.yml +++ b/app/scripts/ansible/roles/nginx_exporter.yml @@ -5,7 +5,12 @@ - name: Set SSH port set_fact: ansible_port: "{{SSH_PORT}}" - + + + - name: collect facts about system services + service_facts: + register: services_state + - name: Open stat port for firewalld firewalld: @@ -14,15 +19,13 @@ permanent: yes immediate: 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" - name: Open stat port for iptables iptables: chain: INPUT - destination_port: 9113 + destination_port: "9113" jump: ACCEPT protocol: tcp ignore_errors: yes