-
Notifications
You must be signed in to change notification settings - Fork 413
/
grading-script.yml
41 lines (37 loc) · 1.04 KB
/
grading-script.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
- hosts: localhost
gather_facts: false
tasks:
- name: Create In-memory Inventory
add_host:
name: workstation-{{OSP_GUID}}.rhpds.opentlc.com
group: workstation
ansible_ssh_private_key_file: ~/.ssh/openstack.pem
ansible_ssh_user: cloud-user
- hosts: workstation
gather_facts: false
tasks:
- name: OpenStack servers
os_server_facts:
cloud: ospcloud
server: 'frontend'
register: openstack_info
- name: Curl website
command: curl "http://{{item.public_v4}}"
with_items:
- "{{ openstack_info.ansible_facts.openstack_servers }}"
register: webpage
- name: Fail
fail:
when: "'Ansible' not in webpage.results[0].stdout"
- hosts: localhost
gather_facts: false
tasks:
- name: Curl website
command: curl "http://frontend1.{{ ANSIBLE_ADVANCE_GUID }}.example.opentlc.com"
register: webpage
- debug: var=webpage.stdout
- name: Fail
fail:
when: "'Ansible' not in webpage.stdout"
- name: Success
debug: msg="Congrats Yours HW Assignment is completed"