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