global: scrape_interval: 5s scrape_timeout: 5s alerting: alertmanagers: - static_configs: - targets: - localhost:{{ alertmanager_port }} scheme: http timeout: 10s rule_files: - '/etc/prometheus/rules.d/*.yml' scrape_configs: {% for host in groups['all'] %} {% with node_exporter_password = hostvars[host].node_exporter_password | default(node_exporter_password), node_exporter_path = hostvars[host].node_exporter_path | default(node_exporter_path) %} - job_name: 'node-exporter-{{ host }}' basic_auth: username: admin password: {{ node_exporter_password }} metrics_path: {{ node_exporter_path }} static_configs: - targets: - '{{ host }}' {% endwith %} {% endfor %}