- hosts: all run_once: true gather_facts: false become: false vars: scrape_config: - targets: >- {{ groups["collectd-prometheus"] | difference(groups["samba-dc"]) | difference(groups["kubelet"]) | sort }} tasks: - name: configmap delegate_to: localhost kubernetes.core.k8s: namespace: victoria-metrics definition: apiVersion: v1 kind: ConfigMap metadata: name: scrape-collectd data: scrape-collectd.yml: |+ {{ scrape_config | to_nice_yaml }}