--- - name: Create telegraf compose directory file: path: "{{ telegraf_compose_dir }}" state: directory - name: Deploy telegraf compose file template: src: docker-compose.yml.j2 dest: "{{ telegraf_compose_dir }}/docker-compose.yml" notify: restart telegraf - name: Start telegraf community.docker.docker_compose_v2: project_src: "{{ telegraf_compose_dir }}" state: present