46 lines
1.8 KiB
YAML
46 lines
1.8 KiB
YAML
---
|
|
|
|
backup_svc:
|
|
name: backup
|
|
|
|
backup_list: "{{ all_services | my_service_attributes(inventory_hostname, 'backup') }}"
|
|
|
|
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"'
|
|
backup_uk_curl_base: '{{ backup_curl_base }}'
|
|
backup_hc_url: '{{ host_backup.hc_url }}'
|
|
backup_uk_url: 'https://status.serguzim.me/api/push/{{ host_backup.uptime_kuma_token }}'
|
|
|
|
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_uk_command_success: '{{ backup_uk_curl_base }} "{{ backup_uk_url }}?status=up&msg={{ backup_msg_success | urlencode }}&ping="'
|
|
backup_hc_command_fail: '{{ backup_hc_curl_base }} --data "{{ backup_msg_fail }}" {{ backup_hc_url }}/fail'
|
|
backup_uk_command_fail: '{{ backup_uk_curl_base }} "{{ backup_uk_url }}?status=down&msg={{ backup_msg_fail | urlencode }}&ping="'
|
|
|
|
backup_default_hooks:
|
|
failure:
|
|
- '{{ backup_hc_curl_base }} --data "{{ backup_msg_fail_location }}${AUTORESTIC_LOCATION}" {{ backup_hc_url }}/fail'
|
|
- '{{ backup_uk_curl_base }} "{{ backup_uk_url }}?status=down&msg={{ backup_msg_fail_location | urlencode }}${AUTORESTIC_LOCATION}&ping="'
|
|
|
|
backup_yml:
|
|
version: 2
|
|
|
|
backends: "{{ vault_backup.locations }}"
|
|
|
|
locations: "{{ backup_list | map_backup_locations(vault_backup.locations, backup_default_hooks ) }}"
|
|
|
|
global:
|
|
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 }}"
|