--- - name: Make sure targets are deployed ansible.builtin.lineinfile: path: '{{ item.path | default(prometheus_target_exporter_defaults[item.id].path) }}' line: '{{ prometheus_target_strategy_lineinfile_prefix ~ (item.host | default(prometheus_target_exporter_defaults[item.id].host)) ~ prometheus_target_strategy_lineinfile_suffix }}' state: present become: true delegate_to: '{{ prometheus_target_host }}' loop: '{{ prometheus_target_exporter }}' notify: - Run command hook - Run shell hook