diff --git a/states/haproxy/templates/haproxy.cfg.j2 b/states/haproxy/templates/haproxy.cfg.j2 index 926ee43..458b304 100644 --- a/states/haproxy/templates/haproxy.cfg.j2 +++ b/states/haproxy/templates/haproxy.cfg.j2 @@ -296,6 +296,7 @@ frontend fe_https from {{ haproxy.config.namespace }} # HTTP Backends +{%- if haproxy.config.vhosts %} {%- for name, values in haproxy.config.vhosts.items() %} {%- if not values.redirect|default(False) %} backend {{ name }} from {{ haproxy.config.namespace }} @@ -308,6 +309,7 @@ backend {{ name }} from {{ haproxy.config.namespace }} http-check {{ step }} {%- endfor %} {%- endif %} +{%- endif %} {%- if values.usecache|default(True) %} {{ cache() }} @@ -336,6 +338,7 @@ backend {{ name }} from {{ haproxy.config.namespace }} {% endfor %} # TCP services +{%- if haproxy.config.services %} {%- for name, values in haproxy.config.services.items() %} listen {{ name }} from {{ haproxy.config.namespace }} bind *:{{ values.port }},:::{{ values.port }} v4v6 name {{ name }} @@ -355,6 +358,7 @@ listen {{ name }} from {{ haproxy.config.namespace }} default-server maxconn 100 weight 100 inter 1s fall 5 {{- tcpendpoints(servers=values.servers|default([]), check=values.check|default(haproxy.config.check)) }} {% endfor %} +{%- endif %} # SPOE Agents {%- for name, values in haproxy.config.spoe.items() %}