forked from taniaesteves/sys-pipeline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
reset-site.yaml
51 lines (42 loc) · 1.31 KB
/
reset-site.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
---
- hosts: kube_cluster
gather_facts: no
become: yes
tasks:
- name: Reset Kubernetes component
shell: "kubeadm reset --force"
ignore_errors: True
- name: Delete flannel.1 interface
command: ip link delete flannel.1
when: network == "flannel" or network == "canal"
ignore_errors: True
- name: Delete cni0 interface
command: ip link delete cni0
when: network == "flannel"
ignore_errors: True
- name: Delete tunl0 interface
command: modprobe -r ipip
when: network == "calico"
ignore_errors: True
- name: Find network interfaces for Kubernetes
shell: "ip addr | grep {{ item }}"
with_items:
- "docker0"
- "flannel.1"
- "cni0"
- "tunl0"
register: find_eths
ignore_errors: True
- name: Delete network interfaces for Kubernetes
when: item.stdout != ''
shell: "ip link delete {{ item.item }}"
with_items: "{{ find_eths['results'] }}"
ignore_errors: True
- name: Find blackhole route rule
shell: "ip route | awk '/blackhole/ {print $2}'"
register: find_blackhole
ignore_errors: True
- name: Delete blackhole route rule
when: find_blackhole.stdout != ''
shell: "ip route del {{ find_blackhole.stdout }}"
ignore_errors: True