Will pass through the hostname to any snapshots set up. The hostname is _not_ derived from the random docker container string but instead takes the name of the _host_ on which docker is running (from ansible facts). The hostname in combination with the tag should point to the correct host -> stack which is being backed up.
92 lines
3.2 KiB
Django/Jinja
92 lines
3.2 KiB
Django/Jinja
services:
|
|
prune:
|
|
image: "mazzolino/restic:{{ restic_version }}"
|
|
hostname: "{{ ansible_hostname }}"
|
|
networks:
|
|
- restic_notify
|
|
environment:
|
|
TZ: "{{ restic_tz }}"
|
|
SKIP_INIT: "{{ not restic_auto_init }}"
|
|
RUN_ON_STARTUP: "true"
|
|
PRUNE_CRON: "{{ restic_prune_cron }}"
|
|
RESTIC_FORGET_ARGS: "{{ restic_forget_args }}"
|
|
RESTIC_REPOSITORY: "{{ restic_repo }}"
|
|
RESTIC_PASSWORD: "{{ restic_pass }}"
|
|
AWS_ACCESS_KEY_ID: "{{ restic_s3_key }}"
|
|
AWS_SECRET_ACCESS_KEY: "{{ restic_s3_secret }}"
|
|
{% if restic_notify_success != None %}
|
|
POST_COMMANDS_SUCCESS: |-
|
|
curl -X POST --data "{\"title\": \"Restic Prune successful\", \"body\": \"{{ ansible_hostname }}\"}" http://notify_success:5000
|
|
{% endif %}
|
|
{% if restic_notify_failure != None %}
|
|
POST_COMMANDS_FAILURE: |-
|
|
curl -X POST --data "{\"title\": \"Restic Prune failed\", \"body\": \"{{ ansible_hostname }}\"}" http://notify_failure:5000
|
|
{% endif %}
|
|
{% if restic_notify_exit != None %}
|
|
POST_COMMANDS_EXIT: |-
|
|
curl -X POST --data "{\"title\": \"Restic Prune exited\", \"body\": \"{{ ansible_hostname }}\"}" http://notify_exit:5000
|
|
{% endif %}
|
|
{% if restic_repo is regex('^/.+') %}
|
|
volumes:
|
|
- "{{ restic_repo }}:{{ restic_repo }}"
|
|
{% endif %}
|
|
|
|
check:
|
|
image: "mazzolino/restic:{{ restic_version }}"
|
|
hostname: docker
|
|
networks:
|
|
- restic_notify
|
|
environment:
|
|
TZ: "{{ restic_tz }}"
|
|
SKIP_INIT: true
|
|
RUN_ON_STARTUP: true
|
|
CHECK_CRON: "{{ restic_check_cron }}"
|
|
RESTIC_CHECK_ARGS: "{{ restic_check_args }}"
|
|
RESTIC_REPOSITORY: "{{ restic_repo }}"
|
|
RESTIC_PASSWORD: "{{ restic_pass }}"
|
|
AWS_ACCESS_KEY_ID: "{{ restic_s3_key }}"
|
|
AWS_SECRET_ACCESS_KEY: "{{ restic_s3_secret }}"
|
|
{% if restic_notify_success != None %}
|
|
POST_COMMANDS_SUCCESS: |-
|
|
curl -X POST --data "{\"title\": \"Restic Check successful\", \"body\": \"{{ ansible_hostname }}\"}" http://notify_success:5000
|
|
{% endif %}
|
|
{% if restic_notify_failure != None %}
|
|
POST_COMMANDS_FAILURE: |-
|
|
curl -X POST --data "{\"title\": \"Restic Check failed\", \"body\": \"{{ ansible_hostname }}\"}" http://notify_failure:5000
|
|
{% endif %}
|
|
{% if restic_notify_exit != None %}
|
|
POST_COMMANDS_EXIT: |-
|
|
curl -X POST --data "{\"title\": \"Restic Check exited\", \"body\": \"{{ ansible_hostname }}\"}" http://notify_exit:5000
|
|
{% endif %}
|
|
{% if restic_repo is regex('^/.+') %}
|
|
volumes:
|
|
- "{{ restic_repo }}:{{ restic_repo }}"
|
|
{% endif %}
|
|
|
|
{% if restic_notify_success != None %}
|
|
notify_success:
|
|
image: mazzolino/apprise-microservice:latest
|
|
networks:
|
|
- restic_notify
|
|
environment:
|
|
NOTIFICATION_URLS: {{ restic_notify_success }}
|
|
{% endif %}
|
|
{% if restic_notify_failure != None %}
|
|
notify_failure:
|
|
image: mazzolino/apprise-microservice:latest
|
|
networks:
|
|
- restic_notify
|
|
environment:
|
|
NOTIFICATION_URLS: {{ restic_notify_failure }}
|
|
{% endif %}
|
|
{% if restic_notify_exit != None %}
|
|
notify_exit:
|
|
image: mazzolino/apprise-microservice:latest
|
|
networks:
|
|
- restic_notify
|
|
environment:
|
|
NOTIFICATION_URLS: {{ restic_notify_exit }}
|
|
{% endif %}
|
|
|
|
networks:
|
|
restic_notify:
|