#jinja2: trim_blocks: True, lstrip_blocks: True global: scrape_interval: "5s" scrape_configs: - job_name: node metrics_path: /metrics scheme: http static_configs: {% for host in groups['vms'] %} - targets: ['{{ hostvars[host].ansible_host }}:9100'] labels: name: '{{ host }}' group: 'vms' {% endfor %} {% for host in groups['proxies'] %} - targets: ['{{ hostvars[host].ansible_host }}:9100'] labels: name: '{{ host }}' group: 'proxies' {% endfor %} {% for host in groups['utility'] %} - targets: ['{{ hostvars[host].ansible_host }}:9100'] labels: name: '{{ host }}' group: 'utility' {% endfor %}