infrastructure/roles/backup/vars/main.yml

63 lines
2.3 KiB
YAML
Raw Normal View History

2024-09-26 22:02:36 +00:00
---
backup_svc:
name: backup
2024-10-05 23:59:46 +00:00
backup_list: "{{ all_services | my_service_attributes(inventory_hostname, 'backup') }}"
backup_list_all: "{{ all_services | my_service_attributes('', 'backup') }}"
2024-10-05 23:59:46 +00:00
backup_msg_start: "Backup started"
backup_msg_fail: "Backup failed"
backup_msg_fail_location: "Backup failed for location: "
backup_msg_success: "Backup successful"
backup_curl_base: 'curl -L -m 10 --retry 5'
backup_hc_curl_base: '{{ backup_curl_base }} -X POST -H "Content-Type: text/plain"'
2024-10-07 19:24:48 +00:00
backup_gatus_curl_base: '{{ backup_curl_base }} -X POST -H "Authorization: Bearer {{ host_backup.gatus_token }}"'
backup_hc_url: '{{ host_backup.hc_url }}'
2024-10-07 19:24:48 +00:00
backup_gatus_url: 'https://status.serguzim.me/api/v1/endpoints/8-backups_backup@{{ ansible_facts.hostname }}/external'
2024-10-05 23:59:46 +00:00
backup_hc_command_start: '{{ backup_hc_curl_base }} --data "{{ backup_msg_start }}" {{ backup_hc_url }}/start'
backup_hc_command_success: '{{ backup_hc_curl_base }} --data "{{ backup_msg_success }}" {{ backup_hc_url }}'
backup_hc_command_fail: '{{ backup_hc_curl_base }} --data "{{ backup_msg_fail }}" {{ backup_hc_url }}/fail'
2024-10-07 19:24:48 +00:00
backup_gatus_command_success: '{{ backup_gatus_curl_base }} "{{ backup_gatus_url }}?success=true"'
backup_gatus_command_fail: '{{ backup_gatus_curl_base }} "{{ backup_gatus_url }}?success=false&error={{ backup_msg_fail | urlencode }}"'
2024-10-05 23:59:46 +00:00
backup_default_hooks:
failure:
- '{{ backup_hc_curl_base }} --data "{{ backup_msg_fail_location }}${AUTORESTIC_LOCATION}" {{ backup_hc_url }}/fail'
2024-10-07 19:24:48 +00:00
- '{{ backup_gatus_curl_base }} "{{ backup_gatus_url }}?success=false&error={{ backup_msg_fail_location | urlencode }}${AUTORESTIC_LOCATION}'
2024-10-05 23:59:46 +00:00
backup_global:
all:
cache-dir: "{{ (service_path, 'cache') | path_join }}"
retry-lock: 5m
forget:
keep-last: 7
keep-daily: 14
keep-weekly: 16
keep-monthly: 12
keep-yearly: 2
host: "{{ ansible_facts.hostname }}"
backup:
host: "{{ ansible_facts.hostname }}"
2024-10-05 23:59:46 +00:00
backup_yml:
version: 2
2024-10-07 19:24:48 +00:00
backends: "{{ vault_backup.backends }}"
2024-10-05 23:59:46 +00:00
2024-10-07 19:24:48 +00:00
locations: "{{ backup_list | map_backup_locations(vault_backup.backends, backup_default_hooks ) }}"
2024-10-05 23:59:46 +00:00
global: "{{ backup_global }}"
backup_yml_all:
version: 2
backends: "{{ vault_backup.backends }}"
locations: "{{ backup_list_all | map_backup_locations(vault_backup.backends, backup_default_hooks ) }}"
global: "{{ backup_global }}"