From 7b0180b1f08b218a7f7ec3792d5edc7909480d7d Mon Sep 17 00:00:00 2001 From: jogrie <94871105+jogrie@users.noreply.github.com> Date: Sun, 23 Jan 2022 14:08:46 +0100 Subject: [PATCH 1/2] fixed backup failure --- tasks/backup.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tasks/backup.yml b/tasks/backup.yml index 93c67f9..a876e9b 100644 --- a/tasks/backup.yml +++ b/tasks/backup.yml @@ -22,11 +22,11 @@ - "{{ gitea_backup_location }}" - name: Backing up gitea before upgrade - ansible.builtin.command: - cmd: "gitea dump -c /etc/gitea/gitea.ini" - chdir: "{{ gitea_backup_location }}" become: true - become_user: "{{ gitea_user }}" + ansible.builtin.command: + cmd: "sudo -u gitea gitea dump -c /etc/gitea/gitea.ini" + chdir: "{{ gitea_backup_location }}" + when: - ansible_facts.services["gitea.service"] is defined - ansible_facts.services["gitea.service"].state == "running" From 9f55d0eefde918afac00ca7cb65d740da0314952 Mon Sep 17 00:00:00 2001 From: L3D Date: Sun, 23 Jan 2022 18:03:07 +0100 Subject: [PATCH 2/2] use variable gitea_user and remove trailing spaces since it is possible to run gitea with an other user defined in the ``{{ gitea_user }}`` variable, I built it in this command. --- tasks/backup.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tasks/backup.yml b/tasks/backup.yml index a876e9b..cc7c290 100644 --- a/tasks/backup.yml +++ b/tasks/backup.yml @@ -24,9 +24,8 @@ - name: Backing up gitea before upgrade become: true ansible.builtin.command: - cmd: "sudo -u gitea gitea dump -c /etc/gitea/gitea.ini" + cmd: "sudo -u {{ gitea_user }} gitea dump -c /etc/gitea/gitea.ini" chdir: "{{ gitea_backup_location }}" - when: - ansible_facts.services["gitea.service"] is defined - ansible_facts.services["gitea.service"].state == "running"