-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexercise12-grade.yaml
More file actions
35 lines (30 loc) · 1.11 KB
/
exercise12-grade.yaml
File metadata and controls
35 lines (30 loc) · 1.11 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
35
- name: Grading the exercise12
hosts: localhost
gather_facts: true
vars:
user: "{{ lookup('env', 'USER') }}"
tasks:
- name: Getting the exercise10-b IP address until it's not empty
ansible.builtin.command:
cmd: "oc get vmi exercise12-b -n namespace-{{ user }} -o jsonpath='{.status.interfaces[1].ipAddress}'"
register: exercise11bip
until: exercise11bip.stdout != ""
retries: 5
delay: 10
- name: Check if exercise12-b app is reachable
ansible.builtin.command:
cmd: virtctl ssh -i /home/{{ user }}/.ssh/id_rsa lab-user@exercise12-a --command 'curl --connect-timeout 2 http://{{ exercise11bip.stdout }}'
ignore_errors: true
no_log: false
register: testcurl
until: testcurl.rc == 0
retries: 5
delay: 10
- name: Check the exercise12-b status
ansible.builtin.fail:
msg: "Ooops, The exercise12-b virtual machine app is not reachable."
when: testcurl.rc != 0
- name: Check the exercise12-b status
ansible.builtin.debug:
msg: "Hey Hey Hey, it's working!!"
when: testcurl.rc == 0