upstream backends in the virtualhost template.

This commit is contained in:
Andrea Dell'Amico 2021-05-09 16:54:56 +02:00
parent 437d0a0b1e
commit 1f4510181e
Signed by: adellam
GPG Key ID: 147ABE6CEB9E20FF
2 changed files with 14 additions and 1 deletions

View File

@ -103,8 +103,13 @@ nginx_logrotate_maxfilesize: "1G"
nginx_logrotate_retention: "52"
nginx_use_common_virthost: False
nginx_upstream_backends: []
# - name: unicorn
# servers:
# - 127.0.0.1:4000 fail_timeout=0
#
# Virtualhost example
# nginx_virthosts:
nginx_virthosts: []
# - virthost_name: '{{ ansible_fqdn }}'
# listen: '{{ http_port }}'
# server_name: '{{ ansible_fqdn }}'

View File

@ -6,6 +6,14 @@ include /etc/nginx/snippets/nginx-websockets.conf;
{% endif %}
{% endif %}
{% for u_bk in nginx_upstream_backends %}
upstream {{ u_bk.name }} {
{% for srv in u_bk.servers %}
server {{ u_bk.srv }};
{% endfor %}
}
{% endfor %}
server {
listen {{ item.http_port | default ('80') }};
server_name {{ item.server_name }} {% if item.serveraliases is defined %}{{ item.serveraliases }}{% endif %};