diff --git a/haproxy/templates/haproxy.jinja b/haproxy/templates/haproxy.jinja index 7ffd921..6407138 100644 --- a/haproxy/templates/haproxy.jinja +++ b/haproxy/templates/haproxy.jinja @@ -92,6 +92,23 @@ backend {{ backend[1].name }} redirect {{ redirect }}{% endfor %} {-% endif %} balance {{ backend[1].balance }} + {%- if 'options' in backend[1] %} + {%- for option in backend[1].options %} + option {{ option }} + {%- endfor %} + {%- endif %} + {%- if 'cookie' in backend[1] %} + cookie {{ backend[1].cookie }} + {%- endif %} + {%- if 'stats' in backend[1] %} + {%- for option, value in backend[1].stats.iteritems() %} + {%- if option == 'enable' and value %} + stats enable + {%- else %} + stats {{ option }} {{ value }} + {%- endif %} + {%- endfor %} + {%- endif %} {%- if 'servers' in backend[1] %} {%- for server in backend[1].servers.iteritems() %} server {{ server[1].name }} {{ server[1].host }}:{{ server[1].port }} {{ server[1].check }}{% endfor %} diff --git a/pillar.example b/pillar.example index 61f4b26..ac894b7 100644 --- a/pillar.example +++ b/pillar.example @@ -74,11 +74,23 @@ haproxy: server1: name: server1-its-name host: 192.168.1.213 + port: 80 check: check backend2: name: static balance: roundrobin redirect: scheme https if !{ ssl_fc } + options: + - http-server-close + - httpclose + - forwardfor except 127.0.0.0/8 + - httplog + cookie: "pm insert indirect" + stats: + enable: True + uri: /url/to/stats + realm: LoadBalancer + auth: "user:password" servers: server1: name: some-server