Merge experimental nach main #3
@ -1,3 +1,25 @@
|
|||||||
|
- 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
|
||||||
|
|
||||||
- name: Ensure Gitea is running
|
- name: Ensure Gitea is running
|
||||||
community.docker.docker_compose:
|
community.docker.docker_compose:
|
||||||
project_src: /opt/gitea
|
project_src: /opt/gitea
|
||||||
|
@ -39,22 +39,30 @@
|
|||||||
enabled: true
|
enabled: true
|
||||||
state: started
|
state: started
|
||||||
|
|
||||||
- name: Stop Gitea for Backup
|
- name: Check if environment.env will get changed
|
||||||
community.docker.docker_compose:
|
ansible.builtin.template:
|
||||||
project_src: /opt/gitea
|
src: environment.env.j2
|
||||||
state: present
|
dest: "/opt/gitea/environment.env"
|
||||||
stopped: true
|
owner: root
|
||||||
|
mode: "600"
|
||||||
|
register: env_diff
|
||||||
|
check_mode: true
|
||||||
notify:
|
notify:
|
||||||
- Ensure Gitea is running
|
- Backup Gitea
|
||||||
|
|
||||||
- name: Backup Gitea Directory
|
- name: Check if docker-compose.yaml will get changed
|
||||||
ansible.builtin.copy:
|
ansible.builtin.template:
|
||||||
src: /opt/gitea/
|
src: docker-compose.yaml.j2
|
||||||
dest: "/opt/gitea.backup@{{ lookup('pipe', 'date --utc --iso-8601=seconds') }}"
|
dest: /opt/gitea/docker-compose.yaml
|
||||||
mode: "700"
|
owner: root
|
||||||
remote_src: true
|
mode: "600"
|
||||||
directory_mode: true
|
register: docker_compose_diff
|
||||||
register: backup
|
check_mode: true
|
||||||
|
notify:
|
||||||
|
- Backup Gitea
|
||||||
|
|
||||||
|
- name: Execute Handlers before changing configfiles
|
||||||
|
meta: flush_handlers
|
||||||
|
|
||||||
- name: Upload Environment File
|
- name: Upload Environment File
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
@ -69,11 +77,10 @@
|
|||||||
dest: /opt/gitea/docker-compose.yaml
|
dest: /opt/gitea/docker-compose.yaml
|
||||||
owner: root
|
owner: root
|
||||||
mode: "600"
|
mode: "600"
|
||||||
validate: /usr/bin/docker compose -f %s config -q
|
|
||||||
notify:
|
notify:
|
||||||
- Output Docker Compose State
|
- Output Docker Compose State
|
||||||
|
|
||||||
- name: Try to reach Gitea
|
- name: Try to start and reach Gitea
|
||||||
block:
|
block:
|
||||||
|
|
||||||
- name: Start Gitea
|
- name: Start Gitea
|
||||||
@ -97,11 +104,16 @@
|
|||||||
notify:
|
notify:
|
||||||
- Ensure Gitea is running
|
- Ensure Gitea is running
|
||||||
|
|
||||||
|
- name: Clean up Gitea Directory before restoring Backup
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /opt/gitea
|
||||||
|
state: absent
|
||||||
|
|
||||||
- name: Restore Gitea Directory from Backup
|
- name: Restore Gitea Directory from Backup
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: "{{ backup.dest }}"
|
src: "{{ backup.dest }}/"
|
||||||
dest: "{{ backup.src }}"
|
dest: /opt/gitea
|
||||||
remote_src: true
|
remote_src: true
|
||||||
mode: "700"
|
mode: preserve
|
||||||
notify:
|
notify:
|
||||||
- Check Gitea HTTP Response
|
- Check Gitea HTTP Response
|
||||||
|
Loading…
Reference in New Issue
Block a user