From 677d6b2aac9773e4c86309ea67d8b0a8c18fd184 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Ro=C3=9Fdeutscher?= Date: Tue, 8 Sep 2015 15:41:28 +0200 Subject: [PATCH] add sort filter to listen and backend directives in haproxy.conf --- haproxy/templates/haproxy.jinja | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/haproxy/templates/haproxy.jinja b/haproxy/templates/haproxy.jinja index 1a06cf5..bfe89a2 100644 --- a/haproxy/templates/haproxy.jinja +++ b/haproxy/templates/haproxy.jinja @@ -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 %}