node_exporter sert en HTTPS via le cert step-ca (--web.config.file + cert-sync owned prometheus, motif .path). Prometheus scrape en scheme https + tls_config (ca=root_ca), vérifie contre l'IP en SAN. Vars : client_metrique_tls_actif, serveur_prometheus_metriques_tls. Prouvé : node_exporter HTTPS 200 (vérif root_ca), HTTP rejeté (400), 4 cibles Prometheus UP en https sans erreur. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
28 lines
950 B
Django/Jinja
28 lines
950 B
Django/Jinja
# Gere par Set-OPS (role serveur_prometheus). Ne pas editer a la main.
|
|
global:
|
|
scrape_interval: {{ serveur_prometheus_intervalle }}
|
|
|
|
scrape_configs:
|
|
- job_name: prometheus
|
|
static_configs:
|
|
- targets: ['localhost:9090']
|
|
|
|
- job_name: node
|
|
{% if serveur_prometheus_metriques_tls | default(false) %}
|
|
scheme: https
|
|
tls_config:
|
|
ca_file: {{ serveur_prometheus_metriques_ca }}
|
|
{% endif %}
|
|
static_configs:
|
|
- targets: {{ groups.get(serveur_prometheus_groupe_metriques, [])
|
|
| map('extract', hostvars)
|
|
| selectattr('ansible_host', 'defined')
|
|
| map(attribute='ansible_host')
|
|
| map('regex_replace', '$', ':' ~ serveur_prometheus_port_node)
|
|
| list | to_json }}
|
|
{% for job in serveur_prometheus_cibles_supplementaires %}
|
|
|
|
- job_name: {{ job.job }}
|
|
static_configs:
|
|
- targets: {{ job.cibles | to_json }}
|
|
{% endfor %}
|