add sort filter to listen and backend directives in haproxy.conf

This commit is contained in:
Marco Roßdeutscher 2015-09-08 15:41:28 +02:00
parent a6545fe434
commit 677d6b2aac

View file

@ -283,7 +283,7 @@ listen {{ listener[1].get('name', listener[0]) }}
default-server {%- for option, value in listener[1].defaultserver.iteritems() %} {{ ' '.join((option, value|string, '')) }} {%- endfor %}
{%- endif %}
{%- if 'servers' in listener[1] %}
{%- for server in listener[1].servers.iteritems() %}
{%- for server in listener[1].servers.iteritems()|sort %}
server {{ server[1].get('name',server[0]) }} {{ server[1].host }}:{{ server[1].port }} {{ server[1].check }} {{ server[1].get('extra', '') }}
{%- endfor %}
{%- endif %}
@ -457,7 +457,7 @@ backend {{ backend[1].get('name',backend[0]) }}
default-server {%- for option, value in backend[1].defaultserver.iteritems() %} {{ ' '.join((option, value|string, '')) }} {%- endfor %}
{%- endif %}
{%- if 'servers' in backend[1] %}
{%- for server in backend[1].servers.iteritems() %}
{%- for server in backend[1].servers.iteritems()|sort %}
server {{ server[1].get('name',server[0]) }} {{ server[1].host }}:{{ server[1].port }} {{ server[1].check }} {{ server[1].get('extra', '') }}
{%- endfor %}
{%- endif %}