Run backup before recreating container(s) if a new image has been downloaded.

This commit is contained in:
Viyurz 2024-02-23 14:29:10 +01:00
parent 81cd44918e
commit 93c291289c
Signed by: Viyurz
SSH key fingerprint: SHA256:IskOHTmhHSJIvAt04N6aaxd5SZCVWW1Guf9tEcxIMj8
3 changed files with 48 additions and 6 deletions

View file

@ -28,7 +28,21 @@
mode: '770' mode: '770'
become: true become: true
- name: Pull/Create/Restart project services - name: Pull project services
community.docker.docker_compose:
project_src: "{{ etebase_project_dir }}"
recreate: never
pull: true
debug: true
when: docker_pull_images | bool
register: etebase_docker_compose_pull_result
- name: Include backup tasks
include_tasks:
file: backup.yml
# Make a backup if we didn't already make one and we pulled a new image
when: not run_backup and etebase_docker_compose_pull_result['actions'] | default([]) | selectattr('pulled_image', 'defined') | length > 0
- name: Create/Restart project services
community.docker.docker_compose: community.docker.docker_compose:
project_src: "{{ etebase_project_dir }}" project_src: "{{ etebase_project_dir }}"
pull: "{{ docker_pull_images | bool }}"

View file

@ -45,9 +45,23 @@
mode: '770' mode: '770'
become: true become: true
- name: Pull/Create/Restart project services - name: Pull project services
community.docker.docker_compose:
project_src: "{{ synapse_project_dir }}"
recreate: never
pull: true
debug: true
when: docker_pull_images | bool
register: synapse_docker_compose_pull_result
- name: Include backup tasks
include_tasks:
file: backup.yml
# Make a backup if we didn't already make one and we pulled a new image
when: not run_backup and synapse_docker_compose_pull_result['actions'] | default([]) | selectattr('pulled_image', 'defined') | length > 0
- name: Create/Restart project services
community.docker.docker_compose: community.docker.docker_compose:
project_src: "{{ synapse_project_dir }}" project_src: "{{ synapse_project_dir }}"
pull: "{{ docker_pull_images | bool }}"
# Restart if config file(s) changed # Restart if config file(s) changed
restarted: "{{ synapse_template_homeserver_result['changed'] | bool }}" restarted: "{{ synapse_template_homeserver_result['changed'] | bool }}"

View file

@ -20,7 +20,21 @@
mode: '770' mode: '770'
become: true become: true
- name: Pull/Create/Restart project services - name: Pull project services
community.docker.docker_compose:
project_src: "{{ vaultwarden_project_dir }}"
recreate: never
pull: true
debug: true
when: docker_pull_images | bool
register: vaultwarden_docker_compose_pull_result
- name: Include backup tasks
include_tasks:
file: backup.yml
# Make a backup if we didn't already make one and we pulled a new image
when: not run_backup and vaultwarden_docker_compose_pull_result['actions'] | default([]) | selectattr('pulled_image', 'defined') | length > 0
- name: Create/Restart project services
community.docker.docker_compose: community.docker.docker_compose:
project_src: "{{ vaultwarden_project_dir }}" project_src: "{{ vaultwarden_project_dir }}"
pull: "{{ docker_pull_images | bool }}"