# It isn't best practice to use this task # Better load the repositories into /opt/docker/[servicename]/services, build them there and then use a docker-compose file for customizing # @todo Refactor\Remove - name: "Merge detached_files with applications.oauth2_proxy.configuration_file" ansible.builtin.set_fact: merged_detached_files: "{{ detached_files + [applications.oauth2_proxy.configuration_file] }}" when: applications[application_id].oauth2_proxy.enabled | default(false) | bool - name: "backup detached files" command: > mv "{{docker_compose.directories.instance}}{{ item }}" "/tmp/{{application_id}}-{{ item }}.backup" args: removes: "{{docker_compose.directories.instance}}{{ item }}" become: true loop: "{{ merged_detached_files | default(detached_files) }}" - name: checkout repository ansible.builtin.shell: git checkout . become: true args: chdir: "{{docker_compose.directories.instance}}" ignore_errors: true - name: pull docker repository git: repo: "{{ repository_address }}" dest: "{{ repository_directory | default(docker_compose.directories.instance) }}" update: yes notify: docker compose project setup become: true - name: "restore detached files" command: > mv "/tmp/{{application_id}}-{{ item }}.backup" "{{docker_compose.directories.instance}}{{ item }}" args: removes: "/tmp/{{application_id}}-{{ item }}.backup" become: true loop: "{{ merged_detached_files | default(detached_files) }}" - name: "copy {{ detached_files }} templates to server" template: src: "{{ item }}.j2" dest: "{{docker_compose.directories.instance}}{{ item }}" loop: "{{ detached_files }}" notify: docker compose project setup