From 51b66a91ca1923992487557851f5344c0bfb93fd Mon Sep 17 00:00:00 2001 From: hoonetorg Date: Tue, 1 Dec 2015 13:16:35 +0100 Subject: [PATCH] make haproxy.cfg template more modular --- haproxy/templates/haproxy.jinja | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/haproxy/templates/haproxy.jinja b/haproxy/templates/haproxy.jinja index adb6d52..ae2490d 100644 --- a/haproxy/templates/haproxy.jinja +++ b/haproxy/templates/haproxy.jinja @@ -89,13 +89,21 @@ userlist {{ id }} #------------------ defaults log {{ salt['pillar.get']('haproxy:defaults:log', 'global') }} +{%- if 'mode' in salt['pillar.get']('haproxy:defaults', {}) -%} mode {{ salt['pillar.get']('haproxy:defaults:mode', 'http') }} +{%- endif %} +{%- if 'retries' in salt['pillar.get']('haproxy:defaults', {}) -%} retries {{ salt['pillar.get']('haproxy:defaults:retries', '3') }} +{%- endif %} +{%- if 'balance' in salt['pillar.get']('haproxy:defaults', {}) -%} balance {{ salt['pillar.get']('haproxy:defaults:balance', 'roundrobin') }} +{%- endif %} {%- if 'monitoruri' in salt['pillar.get']('haproxy:defaults', {}) -%} monitor-uri {{ salt['pillar.get']('haproxy:defaults:monitoruri') }} {%- endif %} +{%- if 'hashtype' in salt['pillar.get']('haproxy:defaults', {}) -%} hash-type {{ salt['pillar.get']('haproxy:defaults:hashtype', 'map-based') }} +{%- endif %} {%- if 'options' in salt['pillar.get']('haproxy:defaults', {}) -%} {{- render_list_of_dictionaries('option', salt['pillar.get']('haproxy:defaults:options')) }} {%- endif %}