2022-08-30 11:54:38 +00:00
|
|
|
# {{ ansible_managed }}
|
|
|
|
|
2024-04-14 22:53:26 +00:00
|
|
|
{% 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 %}
|
2022-08-30 11:54:38 +00:00
|
|
|
server {
|
2024-04-14 22:53:26 +00:00
|
|
|
{% if server.listen is defined %}
|
|
|
|
{% for listen in server.listen %}
|
2022-08-30 11:54:38 +00:00
|
|
|
listen {{ listen }};
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
2024-04-14 22:53:26 +00:00
|
|
|
|
|
|
|
http2 {{ server.http2 | default("on") }};
|
|
|
|
|
|
|
|
{% if server.server_name is defined %}
|
|
|
|
server_name {{ server.server_name }};
|
2022-08-30 11:54:38 +00:00
|
|
|
{% endif %}
|
2024-04-14 22:53:26 +00:00
|
|
|
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') }};
|
2022-08-30 11:54:38 +00:00
|
|
|
|
2024-04-14 22:53:26 +00:00
|
|
|
{% if server.root is defined %}
|
|
|
|
root {{ server.root }};
|
2022-08-30 11:54:38 +00:00
|
|
|
{% endif %}
|
|
|
|
|
2024-04-14 22:53:26 +00:00
|
|
|
index {{ server.index | default('index.html index.htm') }};
|
2022-08-30 11:54:38 +00:00
|
|
|
|
2024-04-14 22:53:26 +00:00
|
|
|
{% if server.ssl_certificate is defined %}
|
|
|
|
ssl_certificate {{ server.ssl_certificate }};
|
2022-08-30 11:54:38 +00:00
|
|
|
{% endif %}
|
2024-04-14 22:53:26 +00:00
|
|
|
{% if server.ssl_certificate_key is defined %}
|
|
|
|
ssl_certificate_key {{ server.ssl_certificate_key }};
|
2022-08-30 11:54:38 +00:00
|
|
|
{% endif %}
|
2024-04-14 22:53:26 +00:00
|
|
|
{% if server.ssl_dhparam is defined %}
|
|
|
|
ssl_dhparam {{ server.ssl_dhparam }};
|
2022-08-30 11:54:38 +00:00
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
location /.well-known/acme-challenge/ {
|
|
|
|
root {{ nginx_root }};
|
|
|
|
try_files $uri =404;
|
|
|
|
}
|
|
|
|
|
2024-04-14 22:53:26 +00:00
|
|
|
{% if server.raw is defined %}
|
|
|
|
{{ server.raw | indent(4) }}
|
2022-08-30 11:54:38 +00:00
|
|
|
{% endif %}
|
|
|
|
}
|
2024-04-14 22:53:26 +00:00
|
|
|
{% endfor %}
|