This repository has been archived on 2023-12-29. You can view files and clone it, but cannot push or open issues or pull requests.
pi-ansible/roles/docker_services/tasks/services/restic.yml

68 lines
2.6 KiB
YAML
Raw Normal View History

2022-12-22 19:18:27 +00:00
# vim: ft=yaml.ansible
2022-12-21 21:25:10 +00:00
---
- name: Deploy Restic with Docker Compose
2023-03-22 18:31:21 +00:00
community.docker.docker_compose:
2022-12-21 21:25:10 +00:00
project_name: restic
2023-08-05 12:36:12 +00:00
state: "{{ 'absent' if down is defined and down else 'present' }}"
restarted: "{{ restart is defined and restart }}"
recreate: "{{ 'always' if recreate is defined and recreate else 'smart' }}"
2022-12-21 21:25:10 +00:00
pull: true
definition:
version: '3.8'
services:
backup:
2023-01-03 21:30:22 +00:00
image: mazzolino/restic:{{ services.restic.version }}
2023-01-14 18:25:13 +00:00
restart: always
2022-12-21 21:25:10 +00:00
environment:
2022-12-23 15:57:37 +00:00
RUN_ON_STARTUP: 'false'
2023-01-03 21:30:22 +00:00
BACKUP_CRON: 0 0 3 * * *
RESTIC_REPOSITORY: b2:{{ secrets.restic.b2.bucket }}:{{ services.restic.repo }}
2022-12-22 19:18:27 +00:00
RESTIC_PASSWORD: "{{ secrets.restic.repo_pw }}"
2022-12-21 21:25:10 +00:00
RESTIC_BACKUP_SOURCES: /mnt/volumes
RESTIC_BACKUP_ARGS: >-
--tag docker-volumes
--exclude '*.tmp'
--verbose
RESTIC_FORGET_ARGS: >-
--keep-last 10
--keep-daily 7
--keep-weekly 5
--keep-monthly 12
PRE_COMMANDS: |-
docker exec -u www-data nextcloud_app_1 php occ maintenance:mode --on
POST_COMMANDS_EXIT: |-
docker exec -u www-data nextcloud_app_1 php occ maintenance:mode --off
2022-12-21 21:25:10 +00:00
B2_ACCOUNT_ID: "{{ secrets.restic.b2.id }}"
B2_ACCOUNT_KEY: "{{ secrets.restic.b2.key }}"
2022-12-22 16:58:48 +00:00
TZ: "{{ timezone }}"
volumes: "{{ restic_volumes }}"
2022-12-21 21:25:10 +00:00
prune:
2023-01-03 21:30:22 +00:00
image: mazzolino/restic:{{ services.restic.version }}
2023-01-14 18:25:13 +00:00
restart: always
2022-12-21 21:25:10 +00:00
environment:
2022-12-23 15:57:37 +00:00
RUN_ON_STARTUP: 'false'
2023-01-03 21:30:22 +00:00
PRUNE_CRON: 0 0 4 * * *
RESTIC_REPOSITORY: b2:{{ secrets.restic.b2.bucket }}:{{ services.restic.repo }}
2022-12-22 19:18:27 +00:00
RESTIC_PASSWORD: "{{ secrets.restic.repo_pw }}"
2022-12-21 21:25:10 +00:00
RESTIC_PRUNE_ARGS: >-
--verbose
B2_ACCOUNT_ID: "{{ secrets.restic.b2.id }}"
B2_ACCOUNT_KEY: "{{ secrets.restic.b2.key }}"
2022-12-22 16:58:48 +00:00
TZ: "{{ timezone }}"
2022-12-21 21:25:10 +00:00
check:
2023-01-03 21:30:22 +00:00
image: mazzolino/restic:{{ services.restic.version }}
2023-01-14 18:25:13 +00:00
restart: always
2022-12-21 21:25:10 +00:00
environment:
2022-12-23 15:57:37 +00:00
RUN_ON_STARTUP: 'false'
2023-01-03 21:30:22 +00:00
CHECK_CRON: 0 0 5 * * *
RESTIC_REPOSITORY: b2:{{ secrets.restic.b2.bucket }}:{{ services.restic.repo }}
2022-12-22 19:18:27 +00:00
RESTIC_PASSWORD: "{{ secrets.restic.repo_pw }}"
2022-12-21 21:25:10 +00:00
RESTIC_CHECK_ARGS: >-
--verbose
B2_ACCOUNT_ID: "{{ secrets.restic.b2.id }}"
B2_ACCOUNT_KEY: "{{ secrets.restic.b2.key }}"
2022-12-22 16:58:48 +00:00
TZ: "{{ timezone }}"