20 lines
686 B
Django/Jinja
20 lines
686 B
Django/Jinja
{%- macro s(key, value, is_bool, min_version) %}
|
|
{% if nginx_version.stdout is version(min_version, 'ge') %}
|
|
{% if is_bool and value %} {{ key }}{% elif not is_bool %} {{ key }}={{ value }}{% endif %}
|
|
{% endif %}
|
|
{%- endmacro -%}
|
|
#
|
|
# {{ ansible_managed }}
|
|
#
|
|
|
|
upstream {{ item.name }} {
|
|
{% for server in item.servers %}
|
|
server {{ server.path }}{% for p in nginx_upstream_server_params if server[p.key] is defined %}{{ s(p.key, server[p.key] | default(p.default), p.is_bool | default(false), p.min_version | default('0.0.1')) }}{% endfor %};
|
|
{% endfor %}
|
|
{% if item.params is defined and item.params is iterable %}
|
|
{% for param in item.params %}
|
|
{{ param }};
|
|
{% endfor %}
|
|
{% endif %}
|
|
}
|