openpunk-ansible/roles/gitea/tasks/backup.yml

51 lines
931 B
YAML
Raw Normal View History

---
# based on advice from https://docs.gitea.io/en-us/backup-and-restore/
- name: Stop Gitea
systemd:
name: gitea
enabled: yes
state: stopped
tags: backup
- name: Make Temp dir
file:
path: /etc/gitea/temp
state: directory
owner: gitea
tags: backup
- name: Dump Gitea
shell:
2024-04-09 21:32:01 +00:00
cmd: gitea dump -c /etc/gitea/gitea.ini --work-path=/etc/gitea --file=gitea-dump.zip --tempdir=/etc/gitea/temp
chdir: /etc/gitea
become: true
become_method: su
become_user: gitea
tags: backup
- name: Fetch backup
fetch:
src: /etc/gitea/gitea-dump.zip
dest: "{{ giteaBackup }}"
flat: true
tags: backup
- name: Remove remote dump
file:
path: "{{ giteaBackup }}"
state: absent
tags: backup
- name: Remove Temp
file:
path: /etc/gitea/temp
state: absent
tags: backup
- name: Start Gitea
systemd:
name: gitea
enabled: yes
state: started
tags: backup