From 0a550b89b993e01accafd40cf9d4d0ffd7d924a5 Mon Sep 17 00:00:00 2001 From: abednarik Date: Fri, 17 Jun 2016 17:18:48 -0300 Subject: [PATCH 1/4] Add support for maxconn per server in haproxy configuration. --- haproxy/templates/haproxy.jinja | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/haproxy/templates/haproxy.jinja b/haproxy/templates/haproxy.jinja index 827f356..2411b4f 100644 --- a/haproxy/templates/haproxy.jinja +++ b/haproxy/templates/haproxy.jinja @@ -346,7 +346,7 @@ listen {{ listener.get('name', listener_name) }} {%- endif %} {%- if 'servers' in listener %} {%- for server_name, server in listener.servers|dictsort %} - server {{ server.get('name', server_name) }} {{ server.host }}{% if 'port' in server %}:{{ server.port }}{% endif %} {{ server.get('check', '') }} {{ server.get('extra', '') }} + server {{ server.get('name', server_name) }} {{ server.host }}{% if 'port' in server %}:{{ server.port }}{% endif %} {% if 'maxconn' in server %} maxconn {{ server.maxconn }}{% endif %} {{ server.get('check', '') }} {{ server.get('extra', '') }} {%- endfor %} {%- endif %} {% endfor %} From df3aeb1e4c0a5ba682a0265fde8b992196a998a7 Mon Sep 17 00:00:00 2001 From: George Robinson Date: Wed, 29 Jun 2016 10:53:27 +0100 Subject: [PATCH 2/4] Support disable overwrite of existing haproxy config file --- haproxy/config.sls | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/haproxy/config.sls b/haproxy/config.sls index 37f366f..b0deda1 100644 --- a/haproxy/config.sls +++ b/haproxy/config.sls @@ -14,3 +14,7 @@ haproxy.config: - service: haproxy.service - watch_in: - service: haproxy.service + {% if salt['pillar.get']('haproxy:overwrite', default=True) == False %} + - unless: + - test -e /etc/haproxy/haproxy.cfg + {% endif %} From 32a732a8c67bf482bc4b16a93b61f857a00e52be Mon Sep 17 00:00:00 2001 From: George Robinson Date: Wed, 29 Jun 2016 17:39:37 +0100 Subject: [PATCH 3/4] Fix test to use config-file-path from pillar --- haproxy/config.sls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/haproxy/config.sls b/haproxy/config.sls index b0deda1..e8c9865 100644 --- a/haproxy/config.sls +++ b/haproxy/config.sls @@ -16,5 +16,5 @@ haproxy.config: - service: haproxy.service {% if salt['pillar.get']('haproxy:overwrite', default=True) == False %} - unless: - - test -e /etc/haproxy/haproxy.cfg + - test -e {{ salt['pillar.get']('haproxy:config_file_path', '/etc/haproxy/haproxy.cfg') }} {% endif %} From 4e5f7632b9ca6af84c15e0f9c1c21c07e37e6d20 Mon Sep 17 00:00:00 2001 From: George Robinson Date: Wed, 29 Jun 2016 17:40:24 +0100 Subject: [PATCH 4/4] Add overwrite option to pillar.example --- pillar.example | 1 + 1 file changed, 1 insertion(+) diff --git a/pillar.example b/pillar.example index e0c9a3f..7d1d408 100644 --- a/pillar.example +++ b/pillar.example @@ -4,6 +4,7 @@ haproxy: enabled: True + overwrite: True # Overwrite an existing config file if present (default behaviour unless set to false) config_file_path: /etc/haproxy/haproxy.cfg global: stats: