-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexercise4-grade.yaml
More file actions
34 lines (28 loc) · 1.1 KB
/
exercise4-grade.yaml
File metadata and controls
34 lines (28 loc) · 1.1 KB
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
- name: Fixing the exercise4
hosts: localhost
gather_facts: true
vars:
user: "{{ lookup('env', 'USER') }}"
tasks:
- name: Get the exercise4 VM details from OpenShift Virtualization
kubernetes.core.k8s_info:
kind: VirtualMachine
api_version: kubevirt.io/v1
name: exercise4
namespace: "namespace-{{ user }}"
register: vm_info
- name: Extract the core count from exercise4 VM spec
ansible.builtin.set_fact:
sockets_count: "{{ vm_info.resources[0].spec.template.spec.domain.cpu.sockets | int }}"
- name: Check if sockets_count is different from 2
ansible.builtin.set_fact:
sockets_count_valid: >-
{{ sockets_count | int > 2 }}
- name: Show success message if condition is true
ansible.builtin.debug:
msg: "Good job, the development team is happy that you solved the problem!"
when: sockets_count_valid
- name: Show failure message if condition is false
ansible.builtin.fail:
msg: "Ops, something went wrong and you have to fix the exercise!"
when: not sockets_count_valid