implemented backup of everything before docker update

This commit is contained in:
Kevin Veen-Birkenbach 2023-12-27 22:12:19 +01:00
parent ceffbc38da
commit a188d1025a
6 changed files with 24 additions and 3 deletions

View File

@ -70,6 +70,7 @@ system_maintenance_backup_services:
- "backup-docker-to-local"
- "backup-remote-to-local"
- "backup-data-to-usb"
- "backup-docker-to-local-everything"
### Defined Services for System Cleanup
system_maintenance_cleanup_services:

View File

@ -3,6 +3,11 @@
name: backup-docker-to-local.service
daemon_reload: yes
- name: "reload backup-docker-to-local-everything.service"
systemd:
name: backup-docker-to-local-everything.service
daemon_reload: yes
- name: "restart backup-docker-to-local.timer"
systemd:
name: backup-docker-to-local.timer

View File

@ -20,6 +20,13 @@
msg: "Warning: Repository is not reachable."
when: git_result is defined and git_result.failed is defined and run_once_cleanup_failed_docker_backups is not defined
- name: configure backup-docker-to-local-everything.service
template:
src: backup-docker-to-local-everything.service.j2
dest: /etc/systemd/system/backup-docker-to-local-everything.service
notify: reload backup-docker-to-local-everything.service
when: run_once_backup_docker_to_local is not defined
- name: configure backup-docker-to-local.service
template:
src: backup-docker-to-local.service.j2

View File

@ -4,5 +4,5 @@ OnFailure=systemd-notifier@%n.service cleanup-failed-docker-backups.service
[Service]
Type=oneshot
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_lock_script }} {{ system_maintenance_services | join(' ') }} --ignore {{system_maintenance_backup_services| join(' ') }} --timeout "{{sytem_maintenance_lock_timeoutbackup_services}}"'
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_lock_script }} {{ system_maintenance_services | join(' ') }} --ignore {{ system_maintenance_backup_services | reject('equalto', 'backup-docker-to-local-everything') | join(' ') }} --timeout "{{sytem_maintenance_lock_timeoutbackup_services}}"'
ExecStart=/bin/sh -c '/usr/bin/python {{backup_docker_to_local_folder}}backup-docker-to-local.py'

View File

@ -0,0 +1,8 @@
[Unit]
Description=backup docker volumes to local folder
OnFailure=systemd-notifier@%n.service cleanup-failed-docker-backups.service
[Service]
Type=oneshot
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_lock_script }} {{ system_maintenance_services | join(' ') }} --ignore {{ system_maintenance_backup_services | reject('equalto', 'backup-docker-to-local') | join(' ') }} --timeout "{{sytem_maintenance_lock_timeoutbackup_services}}"'
ExecStart=/bin/sh -c '/usr/bin/python {{backup_docker_to_local_folder}}backup-docker-to-local.py --everything'

View File

@ -1,6 +1,6 @@
- name: "start backup-docker-to-local.service"
- name: "start backup-docker-to-local-everything.service"
systemd:
name: backup-docker-to-local.service
name: backup-docker-to-local-everything.service
state: started
when: force_backup_before_update | bool