-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path99_delete_lab_ocp.yml
67 lines (56 loc) · 1.8 KB
/
99_delete_lab_ocp.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
- name: Delete the ocp lab
hosts: localhost
gather_facts: false
become: false
tasks:
- name: Assert that cluster is set
ansible.builtin.assert:
that:
cluster is defined
fail_msg: Cluster is not set, did you specify the inventory ?
- name: Add localhost to all and {{ cluster }}
ansible.builtin.add_host:
name: localhost
groups:
- all
- "{{ cluster }}"
- name: Check init settings and vm's
ansible.builtin.include_role:
name: prepare
- name: Add svc to init_vms
ansible.builtin.set_fact:
init_vms: "{{ init_vms | default([]) + groups['svc'] }}"
- name: Add lb to init_vms
ansible.builtin.set_fact:
init_vms: "{{ init_vms | default([]) + groups['loadbalancer'] }}"
- name: Add cluster nodes to init_vms
ansible.builtin.set_fact:
init_vms: "{{ init_vms | default([]) + groups['masters'] + groups['workers'] + groups['bootstrap'] }}"
- name: Debug vms
ansible.builtin.debug:
var: init_vms
- name: Warn about cluster delete
ansible.builtin.pause:
prompt: |-
Deleting cluster: {{ cluster }}
This means all systems from this cluster will be wiped
And the local configuration directory deleted
Press enter to continue
- name: Delete vm
ansible.builtin.include_role:
name: lab
tasks_from: delete_vm.yml
loop: "{{ init_vms }}"
loop_control:
loop_var: host
- name: Delete iso
ansible.builtin.include_role:
name: lab
tasks_from: delete_iso.yml
loop: "{{ init_vms }}"
loop_control:
loop_var: host
- name: Delete cluster dir
ansible.builtin.include_role:
name: ocp_binaries
tasks_from: dir.yml