forked from nais/naisible
-
Notifications
You must be signed in to change notification settings - Fork 0
/
teardown-playbook.yaml
124 lines (111 loc) · 3.07 KB
/
teardown-playbook.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
---
# Remove things created by common initialization play (webproxy, certificates, repositories)
- hosts: all
user: "{{ remote_user }}"
become: yes
tasks:
- name: Remove kubernetes repository
yum_repository:
name: Kubernetes
state: absent
- name: Remove docker repository
yum_repository:
name: Docker
state: absent
- name: Stop services
systemd:
name={{ item }}
state=stopped
enabled=no
with_items:
- kubelet
- docker
ignore_errors: yes
- name: Remove required packages
yum: name={{ item }} state=absent
with_items:
- "docker-ce"
- name: Remove files
file: path={{ item }} state=absent
with_items:
- /etc/systemd/system/docker.service.d
- /etc/systemd/system/kubelet.service
- /etc/kubernetes
- /etc/docker
- name: Unmount docker resources
shell: /bin/umount /run/docker/netns/*
ignore_errors: yes
- hosts: masters
user: "{{ remote_user }}"
become: yes
tasks:
- name: Remove files
file: path={{ item }} state=absent
with_items:
- /root/.helm/repository/repositories.yaml
- /usr/bin/helm-{{helm_version}}
- /usr/bin/helm
- /usr/bin/etcd-{{etcd_version}}
- /usr/bin/etcd
- /usr/bin/etcdctl-{{etcd_version}}
- /usr/bin/etcdctl
- /var/lib/etcd
- /etc/systemd/system/etcd.service
- /etc/sensu/conf.d/nais_master_metrics.json
- name: Disable etcd
systemd: name=etcd enabled=no state=stopped
ignore_errors: yes
- hosts: workers
user: "{{ remote_user }}"
become: yes
tasks:
- name: Remove files
file: path={{ item }} state=absent
with_items:
- /etc/sensu/conf.d/nais_worker_metrics.json
- hosts: localhost
tasks:
- name: Remove target folder
file: path=target state=absent
- hosts: all
user: "{{ remote_user }}"
become: yes
tasks:
- name: Stop services
systemd:
name={{ item }}
state=stopped
enabled=no
with_items:
- kube-proxy
- flannel
ignore_errors: yes
- name: Remove files
file: path={{ item }} state=absent
with_items:
- /etc/systemd/system/kubelet.service
- /usr/bin/kube-proxy*
- /usr/bin/kubelet*
- /usr/bin/kubectl*
- /etc/systemd/system/kube-proxy.service
- /usr/libexec/mk-docker-opts.sh
- /usr/bin/flanneld
- /etc/systemd/system/flannel.service
- /etc/systemd/system/docker.service
- /usr/bin/flanneld-{{flannel_version}}
- /run/docker_opts.env
- /run/flannel/subnet.env
- /var/run/docker
- /var/run/flannel
- /var/run/kubernetes
- /run/docker
- /run/flannel
- /run/kubernetes
- name: Remove docker interface
shell: ip link delete docker0
ignore_errors: yes
- name: Remove flannel interface
shell: ip link delete flannel.1
ignore_errors: yes
- name: Remove nais sensu check directory
file: path=/etc/sensu/plugins/metrics/nais state=absent