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