--- - name: Check whoami directory exist ansible.builtin.file: path: whoami state: directory - name: Copy template conf ansible.builtin.template: backup: true src: "{{ item.src }}" dest: "whoami/{{ item.dest }}" loop: - { src: 'docker-compose.yml.j2', dest: 'docker-compose.yml' } register: whoami_copy_templates_results - name: Force update and restart container community.docker.docker_compose: project_src: whoami state: present pull: true restarted: "{{ whoami_copy_templates_results.changed }}" become: true