Change the inclusion of backup containers so they actually work. They check that restic is enabled globally, and that restic is enabled for the individual stack they belong to. If either of the conditions is not met they do not deploy. This way we can simply enable restic globally with `restic_enable` and by default all stacks will be backed up. But if we want to exclude specific stacks from backups we can do so with the individual `<role>_restic_enable = False` variable. Finally found a good version of doing so with the help of the following medium article: https://medium.com/opsops/is-defined-in-ansible-d490945611ae which basically makes use of default fallbacks instead.
43 lines
1.3 KiB
Django/Jinja
43 lines
1.3 KiB
Django/Jinja
services:
|
|
grocy:
|
|
container_name: grocy
|
|
image: lscr.io/linuxserver/grocy:latest
|
|
networks:
|
|
- caddy
|
|
environment:
|
|
- PUID={{ stack_grocy_puid }}
|
|
- PGID={{ stack_grocy_pgid }}
|
|
- TZ={{ stack_grocy_tz }}
|
|
- UMASK_SET={{ stack_grocy_umask_set }}
|
|
volumes:
|
|
- "{{ arrstack_env_dir }}/config/grocy:/config"
|
|
restart: unless-stopped
|
|
labels:
|
|
caddy: "{{ stack_grocy_subdomain }}"
|
|
caddy.reverse_proxy: "{{ '{{' }}upstreams 80{{ '}}'}}"
|
|
|
|
{% if restic_enable|d(False) == True and stack_grocy_restic_enable|d(False) == True %}
|
|
backup:
|
|
image: mazzolino/restic
|
|
hostname: "{{ ansible_hostname | default() }}"
|
|
environment:
|
|
TZ: "{{ restic_tz }}"
|
|
SKIP_INIT: true
|
|
BACKUP_CRON: "{{ stack_grocy_restic_cron }}"
|
|
RESTIC_REPOSITORY: "{{ restic_repo }}"
|
|
RESTIC_PASSWORD: "{{ restic_pass }}"
|
|
AWS_ACCESS_KEY_ID: "{{ restic_s3_key }}"
|
|
AWS_SECRET_ACCESS_KEY: "{{ restic_s3_secret }}"
|
|
RESTIC_BACKUP_ARGS: >-
|
|
--tag grocy
|
|
RESTIC_BACKUP_SOURCES: "/backup"
|
|
volumes:
|
|
{% if restic_repo is regex('^/.+') %}
|
|
- "{{ restic_repo }}:{{ restic_repo }}"
|
|
{% endif %}
|
|
- "{{ stack_grocy_env_dir }}:/backup/{{ stack_grocy_env_dir }}"
|
|
{% endif %}
|
|
|
|
networks:
|
|
caddy:
|
|
external: true
|