-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexercise7-grade.yaml
More file actions
25 lines (21 loc) · 827 Bytes
/
exercise7-grade.yaml
File metadata and controls
25 lines (21 loc) · 827 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
- name: Grading the exercise7
hosts: localhost
gather_facts: true
vars:
user: "{{ lookup('env', 'USER') }}"
tasks:
- name: Get the VirtualMachineRestore
kubernetes.core.k8s_info:
kind: VirtualMachineRestore
api_version: snapshot.kubevirt.io/v1alpha1
namespace: 'namespace-{{ user }}'
register: vm_restore_info
- name: Check if snapshot has not been restored
ansible.builtin.fail:
msg: "Ooops, the snapshot has not been restored."
when: vm_restore_info.resources | length == 0
- name: Check if snapshot has been restored
ansible.builtin.debug:
msg: "Nice one, the snapshot has been restored!"
when: vm_restore_info.resources[0].status.complete is defined and
vm_restore_info.resources[0].status.complete == true