nginx_exporter First version of role

This commit is contained in:
Timo Makinen 2024-03-20 20:32:14 +00:00
parent 1952f5f96e
commit 92ca4fcba4
5 changed files with 125 additions and 0 deletions

View file

@ -0,0 +1,23 @@
[Unit]
Description=Prometheus NGINX Exporter
After=syslog.target
After=network.target
[Service]
Type=simple
User=nginx_exporter
Group=nginx_exporter
#Environment="SCRAPE_URI={% for host in groups['proxy'] -%}https://{{ host }}/stub_status {% endfor %}"
ExecStart=/usr/local/bin/nginx_exporter \
--web.config.file=/etc/nginx_exporter/web-config.yml \
{% for host in groups['proxy'] %}
--nginx.scrape-uri=https://{{ host }}/stub_status \
{% endfor %}
--nginx.ssl-ca-cert={{ tls_certs }}/ca.crt \
--nginx.ssl-client-cert={{ tls_certs }}/{{ inventory_hostname }}.crt \
--nginx.ssl-client-key={{ tls_private }}/{{ inventory_hostname }}.key
Restart=always
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,11 @@
---
tls_server_config:
key_file: {{ tls_private }}/{{ inventory_hostname }}.key
cert_file: {{ tls_certs }}/{{ inventory_hostname }}.crt
client_ca_file: {{ tls_certs }}/ca.crt
client_auth_type: RequireAndVerifyClientCert
client_allowed_sans:
{% for host in groups['prometheus'] %}
- {{ host }}
{% endfor %}
min_version: TLS13