# {{ ansible_managed }} {% if item.value.upstream is defined %} {% for upstream in item.value.upstream %} upstream {{ upstream.name }} { {% for server in upstream.server %} server {{ server }}; {% endfor %} } {% endfor %} {% endif %} {% if item.value.map is defined %} {% for map in item.value.map %} map {{ map.name }} {{ map.variable }} { {% for k, v in map.content.items() %} {% if k is string and k == "" %} "" {{ v }}; {% else %} {{ k }} {{ v }}; {% endif %} {% endfor %} } {% endfor %} {% endif %} {% for server in item.value.server %} server { {% if server.listen is defined %} {% for listen in server.listen %} listen {{ listen }}; {% endfor %} {% endif %} http2 {{ server.http2 | default("on") }}; {% if server.server_name is defined %} server_name {{ server.server_name }}; {% endif %} access_log {{ server.access_log | default(nginx_var_log_path + '/' + server.server_name + '.access.log main') }}; error_log {{ server.error_log | default(nginx_var_log_path + '/' + server.server_name + '.error.log warn') }}; {% if server.root is defined %} root {{ server.root }}; {% endif %} index {{ server.index | default('index.html index.htm') }}; {% if server.ssl_certificate is defined %} ssl_certificate {{ server.ssl_certificate }}; {% endif %} {% if server.ssl_certificate_key is defined %} ssl_certificate_key {{ server.ssl_certificate_key }}; {% endif %} {% if server.ssl_dhparam is defined %} ssl_dhparam {{ server.ssl_dhparam }}; {% endif %} location /.well-known/acme-challenge/ { root {{ nginx_root }}; try_files $uri =404; } {% if server.raw is defined %} {{ server.raw | indent(4) }} {% endif %} } {% endfor %}