2023-05-01 01:59:58 +02:00
|
|
|
- name: Get stats of docker-compose.yaml
|
|
|
|
ansible.builtin.stat:
|
|
|
|
path: /opt/gitea/docker-compose.yaml
|
|
|
|
register: docker_compose_stat
|
|
|
|
listen:
|
|
|
|
- Backup Gitea
|
|
|
|
|
2023-05-01 01:48:07 +02:00
|
|
|
- name: Stop Gitea for Backup
|
|
|
|
community.docker.docker_compose:
|
|
|
|
project_src: /opt/gitea
|
|
|
|
state: present
|
|
|
|
stopped: true
|
2023-05-01 01:59:58 +02:00
|
|
|
register: docker_compose
|
2023-05-01 01:48:07 +02:00
|
|
|
listen:
|
|
|
|
- Backup Gitea
|
|
|
|
notify:
|
|
|
|
- Ensure Gitea is running
|
2023-05-01 01:59:58 +02:00
|
|
|
when: docker_compose_stat.stat.exists is defined and docker_compose_stat.stat.exists
|
2023-05-01 01:48:07 +02:00
|
|
|
|
|
|
|
- name: Backup Gitea Directory
|
2023-05-01 02:16:38 +02:00
|
|
|
ansible.posix.synchronize:
|
2023-05-01 01:48:07 +02:00
|
|
|
src: /opt/gitea/
|
2023-05-01 17:25:07 +02:00
|
|
|
dest: "/var/backups/gitea.backup@{{ lookup('pipe', 'date --utc --iso-8601=seconds') }}"
|
2023-05-01 01:56:59 +02:00
|
|
|
recursive: true
|
|
|
|
delegate_to: "{{ inventory_hostname }}"
|
2023-05-01 01:48:07 +02:00
|
|
|
listen:
|
|
|
|
- Backup Gitea
|
|
|
|
register: backup
|