restic: Fix backup container conditionals
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.
This commit is contained in:
parent
c5448b17cc
commit
4a5a0beca1
3 changed files with 3 additions and 3 deletions
|
|
@ -290,7 +290,7 @@ services:
|
|||
caddy: "{{ arrstack_gonic_subdomain }}"
|
||||
caddy.reverse_proxy: "{{ '{{' }}upstreams 80{{ '}}'}}"
|
||||
|
||||
{% if restic_enable is not undefined and not false and arrstack_restic_enable is not undefined and not false %}
|
||||
{% if restic_enable|d(False) == True and arrstack_restic_enable|d(False) == True %}
|
||||
backup:
|
||||
image: mazzolino/restic
|
||||
hostname: "{{ ansible_hostname | default() }}"
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ services:
|
|||
caddy: "{{ stack_grocy_subdomain }}"
|
||||
caddy.reverse_proxy: "{{ '{{' }}upstreams 80{{ '}}'}}"
|
||||
|
||||
{% if restic_enable is not undefined and not false and stack_grocy_restic_enable is not undefined and not false %}
|
||||
{% if restic_enable|d(False) == True and stack_grocy_restic_enable|d(False) == True %}
|
||||
backup:
|
||||
image: mazzolino/restic
|
||||
hostname: "{{ ansible_hostname | default() }}"
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ services:
|
|||
environment:
|
||||
REDIS_ARGS: "--save 60 10"
|
||||
|
||||
{% if restic_enable is not undefined and not false and stack_paperless_restic_enable is not undefined and not false %}
|
||||
{% if restic_enable|d(False) == True and stack_paperless_restic_enable|d(False) == True %}
|
||||
backup:
|
||||
image: mazzolino/restic
|
||||
hostname: "{{ ansible_hostname | default() }}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue