diff --git a/group_vars/all/vars.yml b/group_vars/all/vars.yml index f6c2431..aaab1ab 100644 --- a/group_vars/all/vars.yml +++ b/group_vars/all/vars.yml @@ -44,12 +44,12 @@ ntp_servers: - 2.de.pool.ntp.org - 3.de.pool.ntp.org +prometheus_pve_user: prometheus@pve +prometheus_pve_pass: "{{ vault_prometheus_pve_pass }}" + pve_targets: - pve01.ffrgb - pve02.ffrgb -prometheus_pve_user: prometheus@pve -prometheus_pve_pass: "{{ vault_prometheus_pve_pass }}" - site: ffrgb site_domain: regensburg.freifunk.net diff --git a/roles/prometheus/handlers/main.yml b/roles/prometheus/handlers/main.yml index 1706fe0..51336c6 100644 --- a/roles/prometheus/handlers/main.yml +++ b/roles/prometheus/handlers/main.yml @@ -1,10 +1,10 @@ --- +- name: Reload systemd + command: systemctl daemon-reload + - name: Restart prometheus service: name=prometheus state=restarted - name: Restart prometheus-pve-exporter service: name=prometheus-pve-exporter state=restarted - -- name: Reload systemd - command: systemctl daemon-reload diff --git a/roles/prometheus/templates/prometheus.yml.j2 b/roles/prometheus/templates/prometheus.yml.j2 index cad1f24..53a71d6 100644 --- a/roles/prometheus/templates/prometheus.yml.j2 +++ b/roles/prometheus/templates/prometheus.yml.j2 @@ -25,18 +25,23 @@ rule_files: # A scrape configuration containing exactly one endpoint to scrape: # Here it's Prometheus itself. scrape_configs: +{% if node_targets is defined %} - job_name: node static_configs: - targets: {% for target in node_targets %} - {{ target }} {% endfor %} +{% endif %} +{% if fastd_targets is defined %} - job_name: fastd static_configs: - targets: {% for target in fastd_targets %} - {{ target }} {% endfor %} +{% endif %} +{% if pve_targets is defined %} - job_name: pve static_configs: - targets: @@ -53,3 +58,4 @@ scrape_configs: target_label: instance - target_label: __address__ replacement: 127.0.0.1:9221 +{% endif %}