-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexercise7-clean.yaml
More file actions
32 lines (28 loc) · 858 Bytes
/
exercise7-clean.yaml
File metadata and controls
32 lines (28 loc) · 858 Bytes
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
- name: Cleaning the exercise7
hosts: localhost
gather_facts: true
vars:
user: "{{ lookup('env', 'USER') }}"
tasks:
- name: Clean the exercise7
kubernetes.core.k8s:
state: absent
template: "exercise7-vm.yaml.j2"
register: cleanvm
until: cleanvm is succeeded
retries: 60
delay: 10
failed_when: cleanvm is failed or cleanvm.failed
- name: Wait for the Virtual Machine to be removed
kubernetes.core.k8s_info:
kind: VirtualMachine
namespace: "namespace-{{ user }}"
name: "exercise7"
register: cleanvm
retries: 60
delay: 2
until: cleanvm.resources | length == 0
- name: Remove exercise7-restoresnapshot.yaml script
ansible.builtin.file:
path: '/home/{{ user }}/exercise7-restoresnapshot.yaml'
state: absent