From 4f1c51475c211eaa1df35eef7c91567f3d93db98 Mon Sep 17 00:00:00 2001 From: Marius Alwan Meyer <22202402+sporqist@users.noreply.github.com> Date: Sun, 30 Apr 2023 23:59:58 +0000 Subject: [PATCH] Stoppe Gitea nur, wenn eine docker-compose.yaml existiert --- handlers/backup.yaml | 10 +++++++++- handlers/main.yaml | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/handlers/backup.yaml b/handlers/backup.yaml index d0ea999..83dd9d0 100644 --- a/handlers/backup.yaml +++ b/handlers/backup.yaml @@ -1,13 +1,21 @@ +- name: Get stats of docker-compose.yaml + ansible.builtin.stat: + path: /opt/gitea/docker-compose.yaml + register: docker_compose_stat + listen: + - Backup Gitea + - name: Stop Gitea for Backup community.docker.docker_compose: project_src: /opt/gitea state: present stopped: true - ignore_errors: true + register: docker_compose listen: - Backup Gitea notify: - Ensure Gitea is running + when: docker_compose_stat.stat.exists is defined and docker_compose_stat.stat.exists - name: Backup Gitea Directory ansible.builtin.synchronize: diff --git a/handlers/main.yaml b/handlers/main.yaml index 19f3dbb..5299767 100644 --- a/handlers/main.yaml +++ b/handlers/main.yaml @@ -6,10 +6,12 @@ community.docker.docker_compose: project_src: /opt/gitea restarted: true + register: docker_compose - name: Ensure Gitea is running community.docker.docker_compose: project_src: /opt/gitea + register: docker_compose - name: Check Gitea HTTP Response ansible.builtin.uri: