Verschiebe Backup Tasks

This commit is contained in:
Marius Alwan Meyer 2023-04-30 23:48:07 +00:00
parent 130a53ed58
commit 124456ae07
2 changed files with 24 additions and 21 deletions

21
handlers/backup.yaml Normal file
View File

@ -0,0 +1,21 @@
- name: Stop Gitea for Backup
community.docker.docker_compose:
project_src: /opt/gitea
state: present
stopped: true
ignore_errors: true
listen:
- Backup Gitea
notify:
- Ensure Gitea is running
- name: Backup Gitea Directory
ansible.builtin.copy:
src: /opt/gitea/
dest: "/opt/gitea.backup@{{ lookup('pipe', 'date --utc --iso-8601=seconds') }}"
mode: preserve
remote_src: true
directory_mode: true
listen:
- Backup Gitea
register: backup

View File

@ -1,24 +1,6 @@
- name: Stop Gitea for Backup
community.docker.docker_compose:
project_src: /opt/gitea
state: present
stopped: true
ignore_errors: true
listen:
- Backup Gitea
notify:
- Ensure Gitea is running
- name: Backup Gitea Directory
ansible.builtin.copy:
src: /opt/gitea/
dest: "/opt/gitea.backup@{{ lookup('pipe', 'date --utc --iso-8601=seconds') }}"
mode: preserve
remote_src: true
directory_mode: true
listen:
- Backup Gitea
register: backup
- name: Import Backup Handler
ansible.builtin.import_tasks:
file: backup.yaml
- name: Ensure Gitea is restarted
community.docker.docker_compose: