added default for name attribute
name attribute will default to the identifier given in the pillar, but can be overridden by the name attribute
This commit is contained in:
parent
7e31bee197
commit
32e148d232
1 changed files with 3 additions and 3 deletions
|
@ -58,7 +58,7 @@ defaults
|
|||
#---------------------------------------------------------------------
|
||||
{%- if 'frontends' in salt['pillar.get']('haproxy', {}) %}
|
||||
{%- for frontend in salt['pillar.get']('haproxy:frontends', {}).iteritems() %}
|
||||
frontend {{ frontend[1].name }}
|
||||
frontend {{ frontend[1].get(name, frontend[0]) }}
|
||||
bind {{ frontend[1].bind }}
|
||||
{%- if 'redirects' in frontend[1] %}
|
||||
{%- for front_redirect in frontend[1].redirects %}
|
||||
|
@ -90,7 +90,7 @@ redirect {{ front_redirect }}
|
|||
#---------------------------------------------------------------------
|
||||
{%- if 'backends' in salt['pillar.get']('haproxy', {}) %}
|
||||
{%- for backend in salt['pillar.get']('haproxy:backends', {}).iteritems() %} # Backend loop start
|
||||
backend {{ backend[1].name }}
|
||||
backend {{ backend[1].get(name, backend[0]) }}
|
||||
{%- if 'redirects' in backend[1] %}
|
||||
{%- for redirect in backend[1].redirects %} # Redirect loop start
|
||||
redirect {{ redirect }}{% endfor %}
|
||||
|
@ -117,7 +117,7 @@ redirect {{ redirect }}{% 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 %}
|
||||
server {{ server[1].get(name,server[0]) }} {{ server[1].host }}:{{ server[1].port }} {{ server[1].check }}{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %} # Backend loop end
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in a new issue