From e297c177b7244e8ab4e92c6441021f7a57ce2edc Mon Sep 17 00:00:00 2001 From: Yolanda Robla Date: Mon, 6 Mar 2017 14:59:32 +0100 Subject: [PATCH] Improve firewall service check --- rhel_mirror_sync.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rhel_mirror_sync.yml b/rhel_mirror_sync.yml index 67b5831..9f49b28 100644 --- a/rhel_mirror_sync.yml +++ b/rhel_mirror_sync.yml @@ -27,6 +27,12 @@ changed_when: false register: iptables_service_status + - name: Check if firewalld is running + command: systemctl is-active firewalld + ignore_errors: yes + changed_when: false + register: firewalld_service_status + - name: Open firewall port for input ftp (iptables) command: "iptables -A INPUT -p tcp -m tcp --dport 21 -m conntrack --ctstate ESTABLISHED,NEW -j ACCEPT -m comment --comment 'Allow ftp connections to port 21'" when: iptables_service_status.stdout == 'active' @@ -41,7 +47,7 @@ permanent: true state: enabled immediate: true - when: iptables_service_status.stdout != 'active' + when: firewalld_service_status.stdout == 'active' - name: Check if repo already exists stat: path=/var/ftp/pub/osp_repo