--- - name: Check traefik directory exist ansible.builtin.file: path: traefik state: directory - name: Copy template conf ansible.builtin.template: src: "{{ item.src }}" dest: "traefik/{{ item.dest }}" loop: - { src: 'docker-compose.yml', dest: 'docker-compose.yml' } - { src: 'config/traefik.yml', dest: 'config/traefik.yml' } # Avoid restart docker if dynamic_conf updated - name: Copy dynamic_conf conf ansible.builtin.template: src: "config/dynamic_conf.yml" dest: "traefik/config/dynamic_conf.yml" - name: Update and restart container community.docker.docker_compose_v2: project_src: traefik state: present pull: always become: true