mirror of
https://github.com/HanXHX/ansible-nginx.git
synced 2026-02-24 09:03:29 +07:00
First shot proxy (unstable)
This commit is contained in:
19
templates/etc/nginx/upstream/upstream.conf.j2
Normal file
19
templates/etc/nginx/upstream/upstream.conf.j2
Normal file
@@ -0,0 +1,19 @@
|
||||
{%- macro s(key, value, is_bool, min_version) %}
|
||||
{% if nginx_version.stdout | version_compare(min_version, 'ge') %}
|
||||
{% if is_bool and value %} {{ key }}{% else %} {{ key }}={{ value }}{% endif %}
|
||||
{% endif %}
|
||||
{%- endmacro -%}
|
||||
#
|
||||
# {{ ansible_managed }}
|
||||
#
|
||||
|
||||
upstream {{ item.name }} {
|
||||
{% for server in item.servers %}
|
||||
server {{ server.name }}{% 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 %}
|
||||
}
|
||||
Reference in New Issue
Block a user