forked from kubernetes-sigs/kubespray
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdisable-firewall.yml
46 lines (40 loc) · 1.09 KB
/
disable-firewall.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
- hosts: k8s-cluster:etcd:calico-rr
become: yes
tags:
- disable_firewall
vars:
has_firewalld: false
has_rpm: false
tasks:
- name: Determine if has rpm
stat: path=/usr/bin/rpm
register: rpm_check
changed_when: false
always_run: yes
- name: Set the has_rpm fact
set_fact:
has_rpm: true
when: rpm_check.stat.exists
- name: Determine if firewalld installed
command: "rpm -q firewalld"
register: firewalld_check
changed_when: false
failed_when: false
always_run: yes
when: has_rpm
- name: Set the has_firewalld fact
set_fact:
has_firewalld: true
when: (firewalld_check is defined and
firewalld_check.rc is defined and
firewalld_check.rc == 0)
- name: Stop firewalld
command: systemctl stop firewalld
when: has_firewalld
- name: Disable firewalld
command: systemctl disable firewalld
when: has_firewalld
- name: Disable rolekit
command: systemctl disable rolekit
when: has_firewalld
ignore_errors: yes