-
Notifications
You must be signed in to change notification settings - Fork 3
/
tfm-demo-playbook.yml
50 lines (44 loc) · 1.51 KB
/
tfm-demo-playbook.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
- name: Ensure Application is deployed
hosts: all
gather_facts: false
force_handlers: True
pre_tasks:
- name: Gathering facts
setup:
when:
- foreman_params.tfm_webapp_demo is defined
- foreman_params.tfm_webapp_demo
roles:
# The "apache" role has a dependency on the "firewall" role.
# The "firewall" role requires a "firewall_rules" variable be defined.
- name: Ensure Apache is deployed
role: demowebapp.apache
firewall_rules:
# Allow http requests from the load_balancer.
- service: http
when:
- foreman_params.tfm_webapp_demo is defined
- foreman_params.tfm_webapp_role == "backend"
# The "haproxy" role has a dependency on the "firewall" role.
# The "firewall" role requires a "firewall_rules" variable be defined.
- name: Ensure HAProxy is deployed
role: demowebapp.haproxy
firewall_rules:
# Allow 80/tcp connections
- port: 80/tcp
haproxy_appservers:
- name: ip-172-31-30-246.eu-west-3.compute.internal
ip: 172.31.30.246
backend_port: 80
- name: ip-172-31-19-189.eu-west-3.compute.internal
ip: 172.31.19.189
backend_port: 80
when:
- foreman_params.tfm_webapp_demo is defined
- foreman_params.tfm_webapp_role == "loadbalancer"
- name: Ensure Web App is deployed
role: demowebapp.webapp
webapp_version: v1.0
when:
- foreman_params.tfm_webapp_demo is defined
- foreman_params.tfm_webapp_role == "backend"