-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstack_status.yml
72 lines (64 loc) · 1.96 KB
/
stack_status.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
- hosts: loadbalancer
become: true
gather_facts: false
tasks:
- name: verify loadbalancer status
command: service nginx status
changed_when: false
- name: verify nginx listens on port 80
wait_for: port=80 timeout=1
#changed_when: false
tags: ['debug']
- hosts: database
become: true
gather_facts: false
tasks:
- name: verify database status
command: service mysql status
changed_when: false
- name: verify mysql listens on port 3306
wait_for: port=3306 timeout=1
tags: ['debug']
- hosts: webserver
become: true
gather_facts: false
tasks:
- name: verify web servers status
command: service apache2 status
changed_when: false
- name: verify apache listens on port 80
wait_for: port=80 timeout=1
tags: ['debug']
- hosts: control
gather_facts: false
tasks:
- name: verify end-to-end reponse
uri: url=http://{{item}} return_content=yes
with_items: "{{ groups.loadbalancer }}"
register: lb_index
- fail: msg="index failed to return content"
when: "'Hello, from sunny' not in item.content"
with_items: "{{ lb_index.results }}"
tags: ['debug']
- hosts: loadbalancer
gather_facts: false
tasks:
- name: verify web end-to-end reponse
uri: url=http://{{item}} return_content=yes
with_items: "{{ groups.webserver }}"
register: app_index
- fail: msg="index failed to return content"
when: "'Hello, from sunny {{item.item.split('.')[0]}}' not in item.content"
with_items: "{{ app_index.results }}"
tags: ['debug']
- hosts: loadbalancer
tasks:
- name: verify db end-to-end reponse
uri: url=http://{{item}}/db return_content=yes
with_items: "{{ groups.webserver }}"
register: app_index
- fail: msg="db failed to return content"
when: "'Database Connected from {{item.item.split('.')[0]}}' not in item.content"
with_items: "{{ app_index.results }}"
tags: ['debug']