Backport fixes from version in production
Per file detail:
backup.yml
- Added role defaults loading with proper precedence (inventory > vars > defaults)
- Fixed pg_dump permissions: now dumps to /tmp first, then moves to backup directory
update.yml
- Added role defaults loading with proper precedence
- Fixed docker exec commands to use --user {{ forgejo_user }}
- Added monitoring compose file detection and handling
restore.yml
- Added role defaults loading with proper precedence
- Added monitoring compose file detection and handling
- Fixed docker exec for doctor command to use --user {{ forgejo_user }}
Makefile
- Updated .PHONY with new targets
- Replaced auto-generated help with structured categorized help
- Added backup-cron and backup-cron-s3 targets for non-interactive backups
- Added cron job example in help output
This commit is contained in:
parent
dff39e3d36
commit
c09bf58ea7
4 changed files with 143 additions and 20 deletions
|
|
@ -17,6 +17,18 @@
|
|||
upload_to_s3: "{{ forgejo_backup_to_s3 | default(false) }}"
|
||||
|
||||
pre_tasks:
|
||||
- name: Load role defaults as fallback
|
||||
ansible.builtin.include_vars:
|
||||
file: ../roles/forgejo/defaults/main.yml
|
||||
name: role_defaults
|
||||
|
||||
- name: Apply all role defaults for undefined variables
|
||||
ansible.builtin.set_fact:
|
||||
"{{ item.key }}": "{{ vars[item.key] | default(item.value) }}"
|
||||
loop: "{{ role_defaults | dict2items }}"
|
||||
loop_control:
|
||||
label: "{{ item.key }}"
|
||||
|
||||
- name: Display backup information
|
||||
ansible.builtin.debug:
|
||||
msg: |
|
||||
|
|
@ -37,10 +49,15 @@
|
|||
community.postgresql.postgresql_db:
|
||||
name: "{{ forgejo_db_name }}"
|
||||
state: dump
|
||||
target: "{{ forgejo_backup_path }}/database-{{ backup_timestamp }}.sql"
|
||||
target: "/tmp/database-{{ backup_timestamp }}.sql"
|
||||
become_user: postgres
|
||||
when: forgejo_db_type == 'postgres'
|
||||
|
||||
|
||||
- name: Move database backup to backup directory
|
||||
ansible.builtin.command:
|
||||
cmd: mv /tmp/database-{{ backup_timestamp }}.sql {{ forgejo_backup_path }}/database-{{ backup_timestamp }}.sql
|
||||
when: forgejo_db_type == 'postgres'
|
||||
|
||||
- name: Compress database backup
|
||||
community.general.archive:
|
||||
path: "{{ forgejo_backup_path }}/database-{{ backup_timestamp }}.sql"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue