forked from erwstx/websemtower
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloadbalancer.yml
59 lines (52 loc) · 1.12 KB
/
loadbalancer.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
- name: Configure Web servers
hosts: backends
tasks:
- name: Install httpd server
yum:
name:
- firewalld
- httpd
state: latest
- name: Start required services
service:
name: "{{ item }}"
state: started
enabled: true
with_items:
- firewalld
- httpd
- name: Configure firewalld
firewalld:
service: http
state: enabled
permanent: true
immediate: true
- name: Deploy web content
copy:
src: "files/webcontent/{{ inventory_hostname }}/{{ item }}"
dest: /var/www/html
with_items:
- index.html
- index_fichiers
- name: Configure Load Balancers
hosts: lb*
tasks:
- name: Install Haproxy server
yum:
name: haproxy
state: latest
- name: Start Haproxy Service
service:
name: haproxy
state: started
enabled: true
- name: Configure Haproxy
template:
dest: /etc/haproxy/haproxy.cfg
src: templates/haproxy.cfg.j2
notify: restart_lb
handlers:
- name: restart_lb
service:
name: haproxy
state: restarted