Marius Alwan Meyer
305a7a7f67
All checks were successful
ansible-lint / Ansible Lint (push) Successful in 11s
36 lines
907 B
YAML
36 lines
907 B
YAML
- name: Ensure backup directory exists
|
|
ansible.builtin.file:
|
|
path: "/var/backups"
|
|
state: directory
|
|
owner: root
|
|
mode: "755"
|
|
|
|
- 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
|
|
ansible.posix.synchronize:
|
|
src: /opt/gitea/
|
|
dest: "/var/backups/gitea.backup@{{ lookup('pipe', 'date --utc --iso-8601=seconds') }}"
|
|
recursive: true
|
|
delegate_to: "{{ inventory_hostname }}"
|
|
listen:
|
|
- Backup Gitea
|
|
register: backup
|