From 124456ae0787dd2d339ead12c0fe9514ab64a316 Mon Sep 17 00:00:00 2001 From: Marius Alwan Meyer <22202402+sporqist@users.noreply.github.com> Date: Sun, 30 Apr 2023 23:48:07 +0000 Subject: [PATCH] Verschiebe Backup Tasks --- handlers/backup.yaml | 21 +++++++++++++++++++++ handlers/main.yaml | 24 +++--------------------- 2 files changed, 24 insertions(+), 21 deletions(-) create mode 100644 handlers/backup.yaml diff --git a/handlers/backup.yaml b/handlers/backup.yaml new file mode 100644 index 0000000..31a6a52 --- /dev/null +++ b/handlers/backup.yaml @@ -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 diff --git a/handlers/main.yaml b/handlers/main.yaml index 6ab2165..19f3dbb 100644 --- a/handlers/main.yaml +++ b/handlers/main.yaml @@ -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: