-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure-firewall.yaml
61 lines (56 loc) · 1.33 KB
/
configure-firewall.yaml
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
---
- name: Configure firewalld on Mgmt Nodes
hosts: mgmt
gather_facts: yes
become: yes
vars:
external_ports:
- "80/tcp"
- "443/tcp"
- "22/tcp"
internal_networks:
- "10.227.209.0/24"
- "172.17.0.0/16"
- "10.233.0.0/16"
tasks:
- name: Enable firewalld
service:
name: firewalld
enabled: yes
- name: Open External Ports
firewalld:
permanent: yes
immediate: no
port: "{{ item }}"
state: enabled
zone: public
notify: Restart firewalld
loop: "{{ external_ports }}"
- name: Allow All inter-node communication
firewalld:
permanent: yes
immediate: no
rich_rule: "rule family=ipv4 source address={{ item }} accept"
state: enabled
zone: public
notify: Restart firewalld
loop: "{{ internal_networks }}"
- name: Enable Masquerade
firewalld:
masquerade: yes
state: enabled
permanent: yes
zone: public
notify: Restart firewalld
handlers:
- name: Restart firewalld
service:
name: firewalld
state: restarted
notify: Restart Calico
- name: Restart Calico
shell: |
kubectl delete pods -n kube-system $(kubectl get pods -n kube-system -o wide -l k8s-app=calico-node |grep mgmt |awk '{print $1}')
become: no
delegate_to: localhost
run_once: True