- targets: [ '{{ (target.exporter_hostname == prometheus_server) | ternary('127.0.0.1:9999', hostvars[target.exporter_hostname].prometheus_scrape_endpoint) }}' ] labels: instance: '{{ target.instance }}' __param_target: '{{ target.config.target }}' __param_module: '{{ target.config.module }}' {% if 'hostname' in target.config %} __param_hostname: '{{ target.config.hostname }}' {% endif %} {% for name, value in prometheus_target_labels.items() %} {{ name }}: '{{ value }}' {% endfor %}