Move haproxy.cfg to haproxy resource templates

This commit is contained in:
Przemyslaw Kaminski 2015-05-22 15:59:38 +02:00
parent c8f796d16d
commit 8b92e6d3ed
2 changed files with 47 additions and 1 deletions

View File

@ -18,4 +18,4 @@
tasks:
- file: path={{ config_dir.value['src'] }}/ state=directory
- file: path={{ config_dir.value['src'] }}/haproxy.cfg state=touch
- template: src=/vagrant/haproxy.cfg dest={{ config_dir.value['src'] }}/haproxy.cfg
- template: src={{ resource_dir }}/templates/haproxy.cfg dest={{ config_dir.value['src'] }}/haproxy.cfg

View File

@ -0,0 +1,46 @@
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
maxconn 4096
tune.ssl.default-dh-param 2048
pidfile /var/run/haproxy.pid
user haproxy
group haproxy
daemon
stats socket /var/run/haproxy.stats level admin
ssl-default-bind-options no-sslv3
defaults
log global
mode http
option redispatch
option httplog
option dontlognull
option forwardfor
timeout connect 5000
timeout client 50000
timeout server 50000
#frontend default_frontend
# bind 0.0.0.0:80
# default_backend default_service
#backend default_service
# balance roundrobin
{% for service in haproxy_services %}
listen {{ service['name'] }} 0.0.0.0:{{ service['listen_port'] }}
mode http
stats enable
stats uri /haproxy?stats
stats realm Strictly\ Private
stats auth A_Username:YourPassword
stats auth Another_User:passwd
balance roundrobin
option httpclose
option forwardfor
{% for server in service['servers'] %}
server {{ server['name'] }} {{ server['ip'] }}:{{ server['port'] }} check
{% endfor %}
{% endfor %}