2022-08-30 12:49:57 +00:00
|
|
|
# {{ ansible_managed }}
|
|
|
|
|
|
|
|
upstream prometheus_backend {
|
|
|
|
server 127.0.0.1:{{ prometheus_port }};
|
|
|
|
}
|
|
|
|
|
|
|
|
upstream alertmanager_backend {
|
|
|
|
server 127.0.0.1:{{ alertmanager_port }};
|
|
|
|
}
|
|
|
|
|
|
|
|
upstream karma_backend {
|
|
|
|
server 127.0.0.1:{{ karma_port }};
|
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
|
|
|
listen 80;
|
|
|
|
{% if ansible_all_ipv6_addresses | length %}
|
|
|
|
listen [::]:80;
|
|
|
|
{% endif %}
|
|
|
|
server_name {{ prometheus_hostname }};
|
|
|
|
|
|
|
|
access_log /var/log/nginx/prometheus.access.log main;
|
|
|
|
error_log /var/log/nginx/prometheus.error.log warn;
|
|
|
|
|
|
|
|
location /.well-known/acme-challenge/ {
|
|
|
|
root /var/www/html;
|
|
|
|
try_files $uri =404;
|
|
|
|
}
|
|
|
|
|
|
|
|
{% if prometheus_ssl_enabled is defined and
|
|
|
|
prometheus_ssl_enabled %}
|
|
|
|
location / {
|
|
|
|
return 301 https://$server_name$request_uri;
|
|
|
|
}
|
|
|
|
{% endif %}
|
|
|
|
}
|
|
|
|
|
|
|
|
{% if prometheus_ssl_enabled is defined and
|
|
|
|
prometheus_ssl_enabled %}
|
|
|
|
server {
|
2024-04-14 22:30:59 +00:00
|
|
|
listen 443 ssl;
|
2022-08-30 12:49:57 +00:00
|
|
|
{% if ansible_all_ipv6_addresses | length %}
|
2024-04-14 22:30:59 +00:00
|
|
|
listen [::]:443 ssl;
|
2022-08-30 12:49:57 +00:00
|
|
|
{% endif %}
|
2024-04-14 22:30:59 +00:00
|
|
|
|
|
|
|
http2 on;
|
|
|
|
|
2022-08-30 12:49:57 +00:00
|
|
|
server_name {{ prometheus_hostname }};
|
|
|
|
|
|
|
|
auth_basic "Prometheus";
|
|
|
|
auth_basic_user_file {{ prometheus_htpasswd_path }};
|
|
|
|
|
|
|
|
access_log /var/log/nginx/prometheus.access.log main;
|
|
|
|
error_log /var/log/nginx/prometheus.error.log warn;
|
|
|
|
|
|
|
|
{% if prometheus_ssl_certificate is defined %}
|
|
|
|
ssl_certificate {{ prometheus_ssl_certificate }};
|
|
|
|
{% endif %}
|
|
|
|
{% if prometheus_ssl_certificate_key is defined %}
|
|
|
|
ssl_certificate_key {{ prometheus_ssl_certificate_key }};
|
|
|
|
{% endif %}
|
|
|
|
{% if prometheus_ssl_dhparam is defined %}
|
|
|
|
ssl_dhparam {{ prometheus_ssl_dhparam }};
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
location /prometheus/ {
|
|
|
|
proxy_pass http://prometheus_backend/;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /alertmanager/ {
|
|
|
|
proxy_pass http://alertmanager_backend/;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /karma/ {
|
|
|
|
proxy_pass http://karma_backend/;
|
|
|
|
}
|
|
|
|
|
|
|
|
location / {
|
2024-04-14 22:30:59 +00:00
|
|
|
add_header Alt-Svc 'h3=":$server_port"; ma=86400';
|
2022-08-30 12:49:57 +00:00
|
|
|
return 301 /prometheus/;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
{% endif %}
|