infra/ansible/roles/prometheus/templates/prometheus.service.j2
Graham McIntire 922552059f
prom: add prometheus stack (prometheus, alertmanager, grafana, node_exporter)
Provisions prom.w5isp.com (10.0.15.31) as the home-cluster monitoring host.
Prometheus 3.6.0 scrapes the Talos cluster API/nodes/cAdvisor via an external
SA token; Grafana ships with the Prometheus datasource pre-provisioned.

host_vars opens 9090/9093/9100/3000 to 10.0.0.0/16 plus SSH from the home LAN
so the firewall role doesn't lock out admin access.
2026-05-08 09:50:31 -05:00

33 lines
899 B
Django/Jinja

[Unit]
Description=Prometheus
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User={{ prometheus_user }}
Group={{ prometheus_group }}
ExecStart={{ prometheus_install_dir }}/prometheus \
--config.file={{ prometheus_config_dir }}/prometheus.yml \
--storage.tsdb.path={{ prometheus_data_dir }} \
--storage.tsdb.retention.time={{ prometheus_retention_time }} \
{% if prometheus_retention_size != "0" %}
--storage.tsdb.retention.size={{ prometheus_retention_size }} \
{% endif %}
--web.listen-address={{ prometheus_listen_address }} \
{% if prometheus_external_url %}
--web.external-url={{ prometheus_external_url }} \
{% endif %}
--web.enable-lifecycle
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
RestartSec=5
NoNewPrivileges=true
ProtectHome=true
ProtectSystem=full
ReadWritePaths={{ prometheus_data_dir }}
[Install]
WantedBy=multi-user.target