Enable sigvild-gallery role and backup functionality

- Enable sigvild-gallery role in site.yml playbook
- Add backup configuration to host variables
- Integrate restore functionality into main sigvild-gallery tasks
- Add data protection logic to prevent accidental overwrites
- Enable gitea role for complete service deployment

This completes the sigvild-gallery service integration with backup/restore capabilities.
This commit is contained in:
2025-12-07 21:21:50 +01:00
parent 4df87dd57f
commit fe4efcbd5b
3 changed files with 49 additions and 4 deletions

View File

@@ -32,6 +32,10 @@ sigvild_gallery_api_domain: "api.sigvild.no"
sigvild_gallery_local_project_path: "~/sigvild-gallery/" sigvild_gallery_local_project_path: "~/sigvild-gallery/"
# Backup configuration
sigvild_gallery_backup_enabled: true
sigvild_gallery_backup_local_path: "~/sigvild-gallery-backup/"
# Vault-encrypted passwords (create with ansible-vault) # Vault-encrypted passwords (create with ansible-vault)
sigvild_gallery_pb_su_email: "{{ vault_pb_su_email}}" sigvild_gallery_pb_su_email: "{{ vault_pb_su_email}}"
sigvild_gallery_pb_su_password: "{{ vault_pb_su_password}}" sigvild_gallery_pb_su_password: "{{ vault_pb_su_password}}"

View File

@@ -26,6 +26,47 @@
- "{{ sigvild_gallery_data_dir }}" - "{{ sigvild_gallery_data_dir }}"
- "{{ sigvild_gallery_web_root }}" - "{{ sigvild_gallery_web_root }}"
- name: Check for existing gallery data
stat:
path: "{{ sigvild_gallery_data_dir }}/data.db"
register: existing_gallery_data
tags: [restore, backend]
- name: Check for available backup files
local_action:
module: find
paths: "{{ sigvild_gallery_backup_local_path }}"
patterns: "sigvild-gallery-backup-*.tar.gz"
register: backup_files
become: false
when: sigvild_gallery_backup_enabled | default(false)
tags: [restore, backend]
- name: Initialize backup_files when backup disabled
set_fact:
backup_files: {"files": []}
when: not (sigvild_gallery_backup_enabled | default(false))
- name: Restore from backup if no data exists and backups available
include_tasks: restore.yml
when:
- sigvild_gallery_backup_enabled | default(false)
- backup_files.files | length > 0
- not existing_gallery_data.stat.exists
tags: [restore, backend]
- name: Skip restore - existing data found
debug:
msg:
- " Existing gallery data found at {{ sigvild_gallery_data_dir }}/data.db"
- "Skipping restore to preserve existing data"
- "To force restore, manually remove existing data first"
when:
- sigvild_gallery_backup_enabled | default(false)
- backup_files.files | length > 0
- existing_gallery_data.stat.exists
tags: [restore, backend]
- name: Build and deploy backend - name: Build and deploy backend
include_tasks: deploy_backend.yml include_tasks: deploy_backend.yml
tags: [backend, build] tags: [backend, build]

View File

@@ -19,9 +19,9 @@
# tags: ['caddy', 'infrastructure', 'web'] # tags: ['caddy', 'infrastructure', 'web']
# Application services # Application services
- role: sigvild-gallery
tags: ['sigvild', 'gallery', 'wedding']
- role: authentik - role: authentik
tags: ['authentik'] tags: ['authentik']
# - role: gitea - role: gitea
# tags: ['gitea', 'git', 'development'] tags: ['gitea', 'git', 'development']
# - role: sigvild-gallery
# tags: ['sigvild', 'gallery', 'wedding']