-
Notifications
You must be signed in to change notification settings - Fork 102
/
Copy pathlb.yml
38 lines (28 loc) · 843 Bytes
/
lb.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
- hosts: all
become: true
vars:
hostname: mywordpress
modify_hostname: true
handlers:
- name: reload haproxy
service: name=haproxy state=reloaded
tasks:
- name: ==> 0 - add host info
lineinfile: dest=/etc/hosts line="10.0.0.10 {{ hostname }}" state=present
when: modify_hostname
- name: ==> install HAProxy
apt: name=haproxy state=present update_cache=yes
- name: enable HAProxy at system power on
service: name=haproxy enabled=yes
- name: enable HAProxy
lineinfile:
dest: /etc/default/haproxy
regexp: '^ENABLED\s*=.*$'
line: "ENABLED=1"
state: present
- name: copy HAProxy config file
template:
src: templates/haproxy.cfg.j2
dest: /etc/haproxy/haproxy.cfg
notify:
- reload haproxy