adds some default values for essential params

With this PR the haproxy.config state will actually render a valid
haproxy.cfg from default values, even when the values are not
explicitely passed via the pillar. Right now, an invalid cfg is
generated which breaks haproxy on startup.
This commit is contained in:
Marvin Frick 2015-07-29 12:25:43 +02:00
parent b83deb4f28
commit 267e27680a

View file

@ -31,9 +31,9 @@ global
# use- if not designated in their block
#------------------
defaults
log {{ salt['pillar.get']('haproxy:defaults:log') }}
mode {{ salt['pillar.get']('haproxy:defaults:mode') }}
retries {{ salt['pillar.get']('haproxy:defaults:retries') }}
log {{ salt['pillar.get']('haproxy:defaults:log', 'global')}}
mode {{ salt['pillar.get']('haproxy:defaults:mode', 'http') }}
retries {{ salt['pillar.get']('haproxy:defaults:retries', '3') }}
balance {{ salt['pillar.get']('haproxy:defaults:balance', 'roundrobin') }}
{%- if 'options' in salt['pillar.get']('haproxy:defaults', {}) %}
{%- for option in salt['pillar.get']('haproxy:defaults:options') %}
@ -44,7 +44,11 @@ defaults
{%- for timeout in salt['pillar.get']('haproxy:defaults:timeouts') %}
timeout {{ timeout }}
{%- endfor %}
{% endif %}
{%- else %}
timeout client 1m
timeout connect 10s
timeout server 1m
{%- endif %}
{%- if 'errorfiles' in salt['pillar.get']('haproxy:defaults', {}) %}
{%- for errorfile in salt['pillar.get']('haproxy:defaults:errorfiles').iteritems() %}
errorfile {{ errorfile[0] }} {{ errorfile[1] }}