-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathreset-cluster.yaml
65 lines (58 loc) · 1.5 KB
/
reset-cluster.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
62
63
64
65
- hosts: "{{ hosts | default('all') }}"
become: yes
gather_facts: no
tasks:
- name: Reset kubeadm
command: kubeadm reset -f
# Should be extract to a cleanup-cni role
- name: Cleanup "{{ cni | default('flannel') }} CNI info"
file:
path: "{{ item }}"
state: absent
loop:
- /etc/cni
- /run/flannel
- /var/lib/cni
- name: Remove /etc/kubernetes
file:
path: /etc/kubernetes
state: absent
# kubelet will look for this file to determine which container runtime should be used
- name: Remove /etc/default/kubelet
file:
path: /etc/default/kubelet
state: absent
- name: Cleanup "{{ cni | default('flannel') }} CNI network bridge"
shell: "ip link set {{ item }} down"
ignore_errors: yes
loop:
- cni0
- flannel.1
- name: Cleanup "{{ cni | default('flannel') }} CNI"
shell: "ip link delete {{ item }}"
ignore_errors: yes
loop:
- cni0
- flannel.1
- hosts: localhost
gather_facts: no
tasks:
- name: remove master and worker join command
file:
path: "{{ item }}"
state: absent
loop:
- master-join-command
- worker-join-command
- hosts: masters
gather_facts: no
become: yes
tasks:
- name: remove /etc/haproxy/ and .kube
file:
path: "{{ item }}"
state: absent
loop:
- /etc/haproxy
- ./kubeadm-config.yaml
- ./.kube