summaryrefslogtreecommitdiffstats
path: root/ansible/roles/firewall
diff options
context:
space:
mode:
authorTomáš Levora <t.levora@partner.samsung.com>2018-12-19 15:34:21 +0100
committerTomáš Levora <t.levora@partner.samsung.com>2018-12-19 15:37:38 +0100
commitb88839455d4f01a85a0859d896fc8bebfe620aa7 (patch)
treeed182c8a6c7c128ff0168b24b116c60e751fb6a4 /ansible/roles/firewall
parent788be5eb73d8213a450050e149cfa34d670e4ffa (diff)
Add ansible firewall role
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>
Diffstat (limited to 'ansible/roles/firewall')
-rw-r--r--ansible/roles/firewall/tasks/firewall-disable.yml17
-rw-r--r--ansible/roles/firewall/tasks/main.yml2
2 files changed, 19 insertions, 0 deletions
diff --git a/ansible/roles/firewall/tasks/firewall-disable.yml b/ansible/roles/firewall/tasks/firewall-disable.yml
new file mode 100644
index 00000000..9a8a2c10
--- /dev/null
+++ b/ansible/roles/firewall/tasks/firewall-disable.yml
@@ -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
index 00000000..f7bb7c74
--- /dev/null
+++ b/ansible/roles/firewall/tasks/main.yml
@@ -0,0 +1,2 @@
+---
+- include_tasks: "firewall-{{ state }}.yml"