ansible-role-gitea/handlers/backup.yaml
Marius Alwan Meyer a451843b85
All checks were successful
ansible-lint / Ansible Lint (push) Successful in 11s
ansible-lint / Ansible Lint (pull_request) Successful in 10s
Archiviere das Backup
2023-05-01 16:07:56 +00:00

31 lines
815 B
YAML

- 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
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
community.general.archive:
path: /opt/gitea/
dest: "/var/backups/gitea-{{ gitea.hostname }}.{{ gitea.domain }}@{{ lookup('pipe', 'date --utc --iso-8601=seconds') }}.tar.gz"
force_archive: true
format: gz
owner: root
mode: "400"
listen:
- Backup Gitea
register: backup