role service-nginx: only provide location /metrics if node_exporter is availible

This commit is contained in:
Julian Labus 2018-09-14 13:11:14 +02:00
parent c6277df3b7
commit c4f04df30b
No known key found for this signature in database
GPG key ID: 8AF209F2C6B3572A

View file

@ -36,6 +36,7 @@ server {
autoindex_exact_size off;
}
{% if node_exporter_present is defined %}
location ^~ /metrics {
set $metric_addr 127.0.0.1;
proxy_pass http://$metric_addr:9100/metrics;
@ -47,5 +48,6 @@ server {
allow {{ lookup('dig', host, 'qtype=AAAA') }};
deny all;
{% endfor %}
{% endif %}
}
}