Use global variables

This commit is contained in:
nemunaire 2023-03-14 16:51:19 +01:00
parent 63d5eabd20
commit a809600237
1 changed files with 13 additions and 9 deletions

View File

@ -2,8 +2,8 @@
{{ before_server }}
{% endif %}
server {
{% if listen80 is defined -%}
{{ listen80 }}
{% if nginx_listen80 is defined -%}
{{ nginx_listen80 }}
{% else %}
listen 80;
listen [::]:80;
@ -32,8 +32,8 @@ server {
{{ unsecure_server }}
{% endif %}
location /.well-known/acme-challenge {
{% if acme_challenge is defined %}
{{ acme_challenge }}
{% if nginx_acme_challenge is defined %}
{{ nginx_acme_challenge }}
{% else %}
root /var/www/acme;
{% endif %}
@ -41,12 +41,12 @@ server {
}
server {
{% if listen443 is defined -%}
{{ listen443 }}
{% if nginx_listen443 is defined -%}
{{ nginx_listen443 }}
{% else %}
listen {% if ansible_hostname is defined and ansible_hostname == 'ouaset' %}unix:/var/run/nginx-https.sock{% else %}443{% endif %} ssl http2;
listen 443 ssl http2;
listen [::]:443 ssl http2;
{% endif %}
{% endif %}
server_name {% if redirect_to_first is not defined or not redirect_to_first %}{{ domains | join(' ') }}{% else %}{{ domains[0] }}{% endif %};
{% if proxy_protocol is defined %}
@ -80,8 +80,12 @@ server {
}
{% if redirect_to_first is defined and redirect_to_first and domains|length > 1 %}
server {
listen {% if ansible_hostname is defined and ansible_hostname == 'ouaset' %}unix:/var/run/nginx-https.sock{% else %}443{% endif %} ssl http2;
{% if nginx_listen443 is defined -%}
{{ nginx_listen443 }}
{% else %}
listen 443 ssl http2;
listen [::]:443 ssl http2;
{% endif %}
server_name {{ domains[1:] | join(' ') }};
{% if proxy_protocol is defined %}