lab-ansible/roles/apps/templates/compose-files/restic.yml.j2

63 lines
1.8 KiB
Django/Jinja

{# code: language=ansible-jinja #}
# THIS FILE IS MANAGED BY ANSIBLE
version: "3.8"
services:
backup:
image: mazzolino/restic:{{ apps_vars.restic.version }}
restart: always
hostname: {{ hostname }}
domainname: {{ fqdn }}
environment:
RUN_ON_STARTUP: false
BACKUP_CRON: 0 0 * * * *
RESTIC_REPOSITORY: b2:{{ restic.b2.bucket }}:{{ restic.repo.path }}
RESTIC_PASSWORD: {{ restic.repo.password }}
RESTIC_BACKUP_SOURCES: /mnt/volumes
RESTIC_BACKUP_ARGS: >-
--tag data-volumes
--exclude '*.tmp'
--verbose
RESTIC_FORGET_ARGS: >-
--keep-last 12
--keep-daily 7
--keep-weekly 5
--keep-monthly 12
B2_ACCOUNT_ID: {{ restic.b2.id }}
B2_ACCOUNT_KEY: {{ restic.b2.key }}
TZ: {{ timezone }}
volumes:
{% for app in apps_backup|sort %}
- "{{ apps_data_root }}/{{ app }}/data:/mnt/volumes/{{ app }}:ro"
{% endfor %}
- "./data:/mnt/restore:rw"
prune:
image: mazzolino/restic:{{ apps_vars.restic.version }}
restart: always
environment:
RUN_ON_STARTUP: false
PRUNE_CRON: 0 45 3 * * *
RESTIC_REPOSITORY: b2:{{ restic.b2.bucket }}:{{ restic.repo.path }}
RESTIC_PASSWORD: {{ restic.repo.password }}
RESTIC_PRUNE_ARGS: >-
--verbose
B2_ACCOUNT_ID: {{ restic.b2.id }}
B2_ACCOUNT_KEY: {{ restic.b2.key }}
TZ: {{ timezone }}
check:
image: mazzolino/restic:{{ apps_vars.restic.version }}
restart: always
environment:
RUN_ON_STARTUP: false
CHECK_CRON: 0 45 4 * * *
RESTIC_REPOSITORY: b2:{{ restic.b2.bucket }}:{{ restic.repo.path }}
RESTIC_PASSWORD: {{ restic.repo.password }}
RESTIC_CHECK_ARGS: >-
--verbose
B2_ACCOUNT_ID: {{ restic.b2.id }}
B2_ACCOUNT_KEY: {{ restic.b2.key }}
TZ: {{ timezone }}