forked from kubealex/libvirt-k8s-provisioner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path99_cleanup.yml
95 lines (86 loc) · 2.16 KB
/
99_cleanup.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
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
---
- name: Cleanup playbook
hosts: vm_host
vars_files:
- vars/k8s_cluster.yml
become: true
tasks:
- name: Destroy cluster VM
terraform:
force_init: true
project_path: "files/terraform/{{ item }}"
state: absent
loop:
- workers
- masters
- loadbalancer
- nfs
when:
- not rook_ceph.install_rook
- k8s.control_plane.vms > 1
- name: Destroy cluster VM
terraform:
force_init: true
project_path: "files/terraform/{{ item }}"
state: absent
loop:
- workers
- masters
- nfs
when:
- not rook_ceph.install_rook
- k8s.control_plane.vms == 1
- name: Destroy cluster VM
terraform:
force_init: true
project_path: "files/terraform/{{ item }}"
state: absent
loop:
- workers-rook
- workers
- masters
- loadbalancer
when: rook_ceph.install_rook
- name: Destroy libvirt pool and network
terraform:
force_init: true
project_path: "files/terraform/libvirt-resources"
state: absent
- name: Delete all created paths
file:
path: "{{ item }}"
state: absent
loop:
- ~/libvirt-provider
- ~/.terraform.d
- ~/go/bin/terraform-provider-libvirt
- name: Ensure images are deleted
file:
path: "{{ item }}"
state: absent
loop:
- /tmp/OS-GenericCloud-worker.qcow2
- /tmp/OS-GenericCloud-master.qcow2
- /tmp/OS-GenericCloud.qcow2
- name: Delete all created paths - root
become: true
file:
path: "{{ item }}"
state: absent
loop:
- /usr/bin/terraform
- admin.kubeconfig
- name: Cleanup local DNS config
file:
path: "{{ item }}"
state: absent
loop:
- /etc/NetworkManager/dnsmasq.d/libvirt_dnsmasq.conf
- /etc/NetworkManager/conf.d/localdns.conf
- name: Restart NetworkManager and libvirtd
service:
name: "{{ item }}"
state: restarted
loop:
- libvirtd
- NetworkManager