2014-12-07 23:35:44 +00:00
|
|
|
---
|
|
|
|
# Tasks to set up haproxy
|
|
|
|
|
|
|
|
- name: install needed packages
|
|
|
|
yum: pkg={{ item }} state=installed
|
|
|
|
with_items:
|
|
|
|
- haproxy
|
|
|
|
tags:
|
|
|
|
- packages
|
2015-01-06 19:35:41 +00:00
|
|
|
- haproxy
|
2014-12-07 23:35:44 +00:00
|
|
|
|
|
|
|
- name: install haproxy/cfg in prod
|
|
|
|
copy: src={{ item.file }}
|
|
|
|
dest={{ item.dest }}
|
|
|
|
owner=root group=root mode=0600
|
|
|
|
with_items:
|
|
|
|
- { file: haproxy.cfg, dest: /etc/haproxy/haproxy.cfg }
|
2015-01-06 19:40:05 +00:00
|
|
|
notify:
|
|
|
|
- restart haproxy
|
2015-01-06 19:38:18 +00:00
|
|
|
when: env != 'staging'
|
2015-01-06 19:35:41 +00:00
|
|
|
tags:
|
|
|
|
- haproxy
|
2014-12-07 23:35:44 +00:00
|
|
|
|
|
|
|
- name: install haproxy.cfg in stg
|
|
|
|
copy: src={{ item.file }}
|
|
|
|
dest={{ item.dest }}
|
|
|
|
owner=root group=root mode=0600
|
|
|
|
with_items:
|
|
|
|
- { file: haproxy.cfg.stg, dest: /etc/haproxy/haproxy.cfg }
|
2015-01-06 19:38:18 +00:00
|
|
|
when: env == 'staging'
|
2015-01-06 19:40:05 +00:00
|
|
|
notify:
|
|
|
|
- restart haproxy
|
|
|
|
tags:
|
|
|
|
- haproxy
|
|
|
|
|
|
|
|
- name: Make sure haproxy is awake and reporting for duty
|
|
|
|
service: name=haproxy state=started enabled=yes
|
2015-01-06 19:35:41 +00:00
|
|
|
tags:
|
|
|
|
- haproxy
|
2014-12-07 23:35:44 +00:00
|
|
|
|
|
|
|
- name: install limits.conf and 503.http
|
|
|
|
copy: src={{ item.file }}
|
|
|
|
dest={{ item.dest }}
|
|
|
|
owner=root group=root mode=0600
|
|
|
|
with_items:
|
|
|
|
- { file: limits.conf, dest: /etc/security/limits.conf }
|
|
|
|
- { file: 503.http, dest: /etc/haproxy/503.http }
|
2015-01-06 19:35:41 +00:00
|
|
|
tags:
|
|
|
|
- haproxy
|
2015-01-06 19:45:58 +00:00
|
|
|
|
|
|
|
- name: Install libsemanage-python so we can manage selinux with python...
|
|
|
|
yum: name=libsemanage-python state=installed
|
|
|
|
tags:
|
|
|
|
- haproxy
|
|
|
|
- selinux
|
|
|
|
|
|
|
|
- name: Turn on certain selinux booleans so haproxy can bind to ports
|
|
|
|
seboolean: name={{ item }} state=true persistent=true
|
|
|
|
with_items:
|
|
|
|
- haproxy_connect_any
|
|
|
|
tags:
|
|
|
|
- haproxy
|
|
|
|
- selinux
|