Merge branch 'master' of ssh://git-ssh.notandy.de:2222/ansible/roles/nginx

This commit is contained in:
nd 2020-12-20 20:48:23 +01:00
commit 4d44f889cc
No known key found for this signature in database
GPG key ID: 21B5CD4DEE3670E9
2 changed files with 13 additions and 1 deletions

View file

@ -25,6 +25,7 @@
- php-pdo-pgsql
- php-pdo-mysql
- php-apcu
- php-bcmath
notify:
- restart nginx
- restart php-fpm

View file

@ -1,8 +1,19 @@
{% macro upstream_attribute(upstream, attr) %}{% if attr in upstream %} {{attr}}{% endif %}{% endmacro %}
{% macro upstream_attribute_value(upstream, attr) %}{% if attr in upstream %} {{attr}}={{ upstream[attr] }}{% endif %}{% endmacro %}
{% macro upstream_attributes(upstream) -%}
{%- for attr in ["resolve", "backup", "down", "drain"] -%}
{{- upstream_attribute(upstream, attr) -}}
{%- endfor -%}
{%- for attr in ["weight", "fail_timeout", "max_fails", "max_conns", "route", "service", "slow_start"] -%}
{{- upstream_attribute_value(upstream, attr) -}}
{%- endfor -%}
{%- endmacro %}
{% for upstreamname in nginx.upstreams %}
{% set upstream = nginx.upstreams[upstreamname] %}
upstream {{ upstreamname }} {
{% for s in upstream.server %}
server {{ s.address }} {%if s.resolve|d(False) %}resolve {% endif %}max_fails={{ s.max_fails|d(5) }} fail_timeout={{ s.fail_timeout|d(10) }};
server {{ s.address }}{{ upstream_attributes(s) }};
{% endfor %}
}