From 8b92e6d3ed98129417e3fbe0ffc707fd4c115bf5 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kaminski Date: Fri, 22 May 2015 15:59:38 +0200 Subject: [PATCH] Move haproxy.cfg to haproxy resource templates --- resources/haproxy/actions/run.yml | 2 +- resources/haproxy/templates/haproxy.cfg | 46 +++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 resources/haproxy/templates/haproxy.cfg diff --git a/resources/haproxy/actions/run.yml b/resources/haproxy/actions/run.yml index 8b112a0..c8be260 100644 --- a/resources/haproxy/actions/run.yml +++ b/resources/haproxy/actions/run.yml @@ -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 diff --git a/resources/haproxy/templates/haproxy.cfg b/resources/haproxy/templates/haproxy.cfg new file mode 100644 index 0000000..ea258a2 --- /dev/null +++ b/resources/haproxy/templates/haproxy.cfg @@ -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 %}