ansible rework

This commit is contained in:
Sergei Poljanski 2025-11-04 11:06:35 +02:00
commit eecff4345a
47 changed files with 1995 additions and 538 deletions

View file

@ -16,19 +16,54 @@
file_type: file
register: existing_dumps
- name: Create backup archive from old server
- name: Create temporary staging directory for backup
file:
path: /tmp/forgejo-backup-staging
state: directory
mode: '0755'
become: true
- name: Copy database to staging
copy:
src: /srv/gitea/gitea.db
dest: /tmp/forgejo-backup-staging/gitea.db
remote_src: true
become: true
- name: Create data directory in staging
file:
path: /tmp/forgejo-backup-staging/data
state: directory
mode: '0755'
become: true
- name: Copy data directories to staging
copy:
src: "/srv/gitea/data/{{ item }}/"
dest: "/tmp/forgejo-backup-staging/data/{{ item }}/"
remote_src: true
loop:
- avatars
- repo-avatars
- repo-archive
- attachments
- gitea-repositories
become: true
ignore_errors: true
- name: Create backup archive from staging
archive:
path:
- /srv/gitea/gitea.db
- /srv/gitea/data/avatars
- /srv/gitea/data/repo-avatars
- /srv/gitea/data/repo-archive
- /srv/gitea/data/attachments
- /srv/gitea/data/gitea-repositories
path: /tmp/forgejo-backup-staging
dest: /tmp/forgejo-full-backup-{{ ansible_date_time.date }}.tar.gz
format: gz
become: true
- name: Clean up staging directory
file:
path: /tmp/forgejo-backup-staging
state: absent
become: true
- name: Display found backup files
debug:
msg: |