2023-04-29 21:52:00 +02:00
|
|
|
- name: Stop Gitea for Backup
|
|
|
|
community.docker.docker_compose:
|
|
|
|
project_src: /opt/gitea
|
|
|
|
state: present
|
|
|
|
stopped: true
|
|
|
|
ignore_errors: true
|
|
|
|
listen:
|
|
|
|
- Backup Gitea
|
|
|
|
notify:
|
|
|
|
- Ensure Gitea is running
|
|
|
|
|
|
|
|
- name: Backup Gitea Directory
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: /opt/gitea/
|
|
|
|
dest: "/opt/gitea.backup@{{ lookup('pipe', 'date --utc --iso-8601=seconds') }}"
|
|
|
|
mode: preserve
|
|
|
|
remote_src: true
|
|
|
|
directory_mode: true
|
|
|
|
listen:
|
|
|
|
- Backup Gitea
|
|
|
|
register: backup
|
|
|
|
|
2023-04-29 22:22:03 +02:00
|
|
|
- name: Ensure Gitea is restarted
|
|
|
|
community.docker.docker_compose:
|
|
|
|
project_src: /opt/gitea
|
|
|
|
restarted: true
|
|
|
|
|
2023-04-29 20:37:01 +02:00
|
|
|
- name: Ensure Gitea is running
|
2023-04-29 16:56:41 +02:00
|
|
|
community.docker.docker_compose:
|
|
|
|
project_src: /opt/gitea
|
|
|
|
|
2023-04-29 20:37:01 +02:00
|
|
|
- name: Check Gitea HTTP Response
|
2023-04-29 16:56:41 +02:00
|
|
|
ansible.builtin.uri:
|
|
|
|
url: "https://{{ gitea.hostname }}.{{ gitea.domain }}"
|
|
|
|
register: _result
|
|
|
|
until: _result.status == 200
|
|
|
|
retries: 30
|
|
|
|
delay: 2
|
2023-04-29 20:37:01 +02:00
|
|
|
|
|
|
|
- name: Output Docker Compose State
|
|
|
|
ansible.builtin.debug:
|
|
|
|
var: docker_compose
|
|
|
|
when: gitea_docker_compose.changed
|