2025-02-04 22:37:07 +01:00
|
|
|
# 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
|
2025-02-03 11:44:13 +01:00
|
|
|
- name: "Merge detached_files with applications.oauth2_proxy.configuration_file"
|
2025-01-26 16:14:30 +01:00
|
|
|
ansible.builtin.set_fact:
|
2025-02-03 11:44:13 +01:00
|
|
|
merged_detached_files: "{{ detached_files + [applications.oauth2_proxy.configuration_file] }}"
|
2025-01-26 17:38:34 +01:00
|
|
|
when: oauth2_proxy_active
|
2025-01-26 16:14:30 +01:00
|
|
|
|
2025-01-11 15:39:30 +01:00
|
|
|
- name: "backup detached files"
|
2024-05-26 21:09:36 +02:00
|
|
|
command: >
|
2025-02-04 18:14:37 +01:00
|
|
|
mv "{{docker_compose.directories.instance}}{{ item }}" "/tmp/{{application_id}}-{{ item }}.backup"
|
2024-05-26 21:09:36 +02:00
|
|
|
args:
|
2025-02-04 18:14:37 +01:00
|
|
|
removes: "{{docker_compose.directories.instance}}{{ item }}"
|
2024-05-26 21:09:36 +02:00
|
|
|
become: true
|
2025-01-27 00:52:49 +01:00
|
|
|
loop: "{{ merged_detached_files | default(detached_files) }}"
|
2024-05-26 21:09:36 +02:00
|
|
|
|
|
|
|
- name: checkout repository
|
|
|
|
ansible.builtin.shell: git checkout .
|
|
|
|
become: true
|
|
|
|
args:
|
2025-02-04 18:14:37 +01:00
|
|
|
chdir: "{{docker_compose.directories.instance}}"
|
2024-05-26 21:09:36 +02:00
|
|
|
ignore_errors: true
|
|
|
|
|
|
|
|
- name: pull docker repository
|
|
|
|
git:
|
|
|
|
repo: "{{ repository_address }}"
|
2025-02-04 18:14:37 +01:00
|
|
|
dest: "{{ repository_directory | default(docker_compose.directories.instance) }}"
|
2024-05-26 21:09:36 +02:00
|
|
|
update: yes
|
|
|
|
notify: docker compose project setup
|
|
|
|
become: true
|
|
|
|
|
2025-01-11 15:39:30 +01:00
|
|
|
- name: "restore detached files"
|
2024-05-26 21:09:36 +02:00
|
|
|
command: >
|
2025-02-04 18:14:37 +01:00
|
|
|
mv "/tmp/{{application_id}}-{{ item }}.backup" "{{docker_compose.directories.instance}}{{ item }}"
|
2024-05-26 21:09:36 +02:00
|
|
|
args:
|
2025-01-30 15:04:23 +01:00
|
|
|
removes: "/tmp/{{application_id}}-{{ item }}.backup"
|
2024-05-26 21:09:36 +02:00
|
|
|
become: true
|
2025-01-27 00:52:49 +01:00
|
|
|
loop: "{{ merged_detached_files | default(detached_files) }}"
|
2024-05-26 21:09:36 +02:00
|
|
|
|
2025-01-26 17:38:34 +01:00
|
|
|
- name: "copy {{ detached_files }} templates to server"
|
2024-05-26 21:09:36 +02:00
|
|
|
template:
|
|
|
|
src: "{{ item }}.j2"
|
2025-02-04 18:14:37 +01:00
|
|
|
dest: "{{docker_compose.directories.instance}}{{ item }}"
|
2024-05-26 21:09:36 +02:00
|
|
|
loop: "{{ detached_files }}"
|
|
|
|
notify: docker compose project setup
|