Add ansible firewall role 22/74922/1
authorTomáš Levora <t.levora@partner.samsung.com>
Wed, 19 Dec 2018 14:34:21 +0000 (15:34 +0100)
committerTomáš Levora <t.levora@partner.samsung.com>
Wed, 19 Dec 2018 14:37:38 +0000 (15:37 +0100)
Adding role to disable firewall to prevent any issue with communication
during the installation

Change-Id: I2390f0bc5062933e6a8bf4dcbc0b255b283f993d
Issue-ID: OOM-1551
Signed-off-by: Tomáš Levora <t.levora@partner.samsung.com>
ansible/roles/firewall/tasks/firewall-disable.yml [new file with mode: 0644]
ansible/roles/firewall/tasks/main.yml [new file with mode: 0644]

diff --git a/ansible/roles/firewall/tasks/firewall-disable.yml b/ansible/roles/firewall/tasks/firewall-disable.yml
new file mode 100644 (file)
index 0000000..9a8a2c1
--- /dev/null
@@ -0,0 +1,17 @@
+---
+- name: Check if firewalld is installed
+  yum:
+    list: firewalld
+    disablerepo: "*"
+  register: firewalld_check
+
+- name: Stop and disable firewalld if exists
+  service:
+    name: firewalld
+    state: stopped
+    enabled: no
+  when: firewalld_check.results|selectattr('yumstate', 'match', 'installed')|list|length != 0
+
+- name: Flush iptables
+  iptables:
+    flush: true
diff --git a/ansible/roles/firewall/tasks/main.yml b/ansible/roles/firewall/tasks/main.yml
new file mode 100644 (file)
index 0000000..f7bb7c7
--- /dev/null
@@ -0,0 +1,2 @@
+---
+- include_tasks: "firewall-{{ state }}.yml"