mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-07-17 22:14:25 +02:00
Finished new backup implementation logik
This commit is contained in:
parent
70f7953027
commit
7145213f45
@ -1,9 +1,9 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=backup docker volumes to local folder
|
Description=backup all docker volumes to local folder
|
||||||
OnFailure=sys-alm-compose.cymais@%n.service sys-cln-faild-bkps.cymais.service
|
OnFailure=sys-alm-compose.cymais@%n.service sys-cln-faild-bkps.cymais.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_lock_script }} {{ system_maintenance_services | join(' ') }} --ignore {{ system_maintenance_backup_services | reject('equalto', 'sys-bkp-docker-2-loc') | join(' ') }} --timeout "{{system_maintenance_lock_timeout_backup_services}}"'
|
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_lock_script }} {{ system_maintenance_services | join(' ') }} --ignore {{ system_maintenance_backup_services | reject('equalto', 'sys-bkp-docker-2-loc') | join(' ') }} --timeout "{{system_maintenance_lock_timeout_backup_services}}"'
|
||||||
ExecStart=/bin/sh -c '/usr/bin/python {{backup_docker_to_local_folder}}backup-docker-to-local.py --compose-dir {{path_docker_compose_instances}} --everything'
|
ExecStart=/bin/sh -c '{{ bkp_docker_to_local_exec }} --everything'
|
||||||
ExecStartPost=/bin/sh -c '/bin/systemctl start sys-rpr-docker-soft.cymais.service &'
|
ExecStartPost=/bin/sh -c '/bin/systemctl start sys-rpr-docker-soft.cymais.service &'
|
@ -5,5 +5,5 @@ OnFailure=sys-alm-compose.cymais@%n.service sys-cln-faild-bkps.cymais.service
|
|||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_lock_script }} {{ system_maintenance_services | join(' ') }} --ignore {{ system_maintenance_backup_services | reject('equalto', 'sys-bkp-docker-2-loc-everything') | join(' ') }} --timeout "{{system_maintenance_lock_timeout_backup_services}}"'
|
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_lock_script }} {{ system_maintenance_services | join(' ') }} --ignore {{ system_maintenance_backup_services | reject('equalto', 'sys-bkp-docker-2-loc-everything') | join(' ') }} --timeout "{{system_maintenance_lock_timeout_backup_services}}"'
|
||||||
ExecStart=/bin/sh -c '/usr/bin/python {{backup_docker_to_local_folder}}backup-docker-to-local.py --compose-dir {{path_docker_compose_instances}}'
|
ExecStart=/bin/sh -c '{{ bkp_docker_to_local_exec }}'
|
||||||
ExecStartPost=/bin/sh -c '/bin/systemctl start sys-rpr-docker-soft.cymais.service &'
|
ExecStartPost=/bin/sh -c '/bin/systemctl start sys-rpr-docker-soft.cymais.service &'
|
@ -1,2 +1,46 @@
|
|||||||
bkp_docker_to_local_pkg: backup-docker-to-local
|
bkp_docker_to_local_pkg: backup-docker-to-local
|
||||||
|
|
||||||
|
# Mapping logic for backup-docker-to-local CLI arguments
|
||||||
|
#
|
||||||
|
# - bkp_docker_to_local_database_routine: All service names where backup.database_routine is set (for --database-containers)
|
||||||
|
# - bkp_docker_to_local_no_stop_required: All images where backup.no_stop_required is set (for --images-no-stop-required)
|
||||||
|
# - bkp_docker_to_local_disabled: All images where backup.disabled is set (for --images-no-backup-required)
|
||||||
|
# CLI-ready variables render these lists as argument strings.
|
||||||
|
|
||||||
|
# Gather mapped values as lists
|
||||||
|
bkp_docker_to_local_database_routine: >-
|
||||||
|
{{ applications | find_dock_val_by_bkp_entr('database_routine', 'name') | list }}
|
||||||
|
|
||||||
|
bkp_docker_to_local_no_stop_required: >-
|
||||||
|
{{ applications | find_dock_val_by_bkp_entr('no_stop_required', 'image') | list }}
|
||||||
|
|
||||||
|
bkp_docker_to_local_disabled: >-
|
||||||
|
{{ applications | find_dock_val_by_bkp_entr('disabled', 'image') | list }}
|
||||||
|
|
||||||
|
# CLI argument strings (only set if list not empty)
|
||||||
|
bkp_docker_to_local_database_routine_cli: >-
|
||||||
|
{% if bkp_docker_to_local_database_routine | length > 0 -%}
|
||||||
|
--database-containers="{{ bkp_docker_to_local_database_routine | join(' ') }}"
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
bkp_docker_to_local_no_stop_required_cli: >-
|
||||||
|
{% if bkp_docker_to_local_no_stop_required | length > 0 -%}
|
||||||
|
--images-no-stop-required="{{ bkp_docker_to_local_no_stop_required | join(' ') }}"
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
bkp_docker_to_local_disabled_cli: >-
|
||||||
|
{% if bkp_docker_to_local_disabled | length > 0 -%}
|
||||||
|
--images-no-backup-required="{{ bkp_docker_to_local_disabled | join(' ') }}"
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
# List of CLI args for convenience (e.g. for looping or joining)
|
||||||
|
bkp_docker_to_local_cli_args_list:
|
||||||
|
- "{{ bkp_docker_to_local_database_routine_cli }}"
|
||||||
|
- "{{ bkp_docker_to_local_no_stop_required_cli }}"
|
||||||
|
- "{{ bkp_docker_to_local_disabled_cli }}"
|
||||||
|
|
||||||
|
bkp_docker_to_local_exec: >-
|
||||||
|
/usr/bin/python {{ backup_docker_to_local_folder }}backup-docker-to-local.py
|
||||||
|
--compose-dir {{ path_docker_compose_instances }}
|
||||||
|
{{ bkp_docker_to_local_cli_args_list | select('string') | join(' ') }}
|
||||||
|
| trim
|
Loading…
x
Reference in New Issue
Block a user