-
Notifications
You must be signed in to change notification settings - Fork 1
/
playbook.yml
31 lines (30 loc) · 973 Bytes
/
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
---
- hosts: localhost
vars:
haproxy_app_name: ankurapp
haproxy_mode: http
haproxy_enable_stats: enable
haproxy_algorithm: roundrobin
haproxy_backend_servers:
- {name: server1, ip: 150.150.150.108, port: 80, paramstring: cookie A check}
- {name: server2, ip: 150.150.150.112, port: 80, paramstring: cookie A check}
haproxy_stats_users:
- {username: joe, password: soap}
tasks:
- name: Update apt cache
apt: update_cache=yes cache_valid_time=3600
- name: Install haproxy
apt: name=haproxy state=present
- name: Enable init script
replace: dest='/etc/default/haproxy'
regexp='ENABLED=0'
replace='ENABLED=1'
- name: Update HAProxy config
template: src=templates/haproxy.cfg
dest=/etc/haproxy/haproxy.cfg
backup=yes
notify:
- restart haproxy
handlers:
- name: restart haproxy
service: name=haproxy state=restarted