Merge experimental nach main #3

Merged
sporq merged 16 commits from experimental into main 2023-05-01 18:37:47 +02:00
2 changed files with 53 additions and 19 deletions
Showing only changes of commit 6817fe0ff9 - Show all commits

View File

@ -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
community.docker.docker_compose:
project_src: /opt/gitea

View File

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