-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtear_down.yaml
39 lines (35 loc) · 974 Bytes
/
tear_down.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
- name: Destroy Kubernetes cluster components
hosts: localhost
gather_facts: false
vars:
count: "{{ controllers if role == 'controller' else workers }}"
state: absent
tasks:
- name: Loading var files
include_vars:
dir: host_vars
ignore_unknown_extensions: True
extensions: ['yaml', 'json']
- import_tasks: compute-instances.yaml
- import_tasks: disks.yaml
- import_tasks: ip-address.yaml
- import_tasks: balancer.yaml
- import_tasks: firewall.yaml
- name: removing network
block:
- import_tasks: subnetwork.yaml
- import_tasks: network.yaml
rescue:
- name: Network still in use
debug:
msg: "Network service cant be removed, some resources still using it"
- name: cleanup local facts
local_action:
module: file
path: "host_vars/{{ item }}-{{ role }}.json"
state: "{{ state }}"
loop:
- address
- disk
- network
- subnetwork