|
@@ -1,16 +1,15 @@
|
|
#!/bin/bash
|
|
#!/bin/bash
|
|
# {{ ansible_managed }}
|
|
# {{ ansible_managed }}
|
|
|
|
|
|
-EMAIL_ADDRESS="root@localhost"
|
|
|
|
LOG_FILE="/var/log/rclone/rclone-$(date +%Y-%m-%d).log"
|
|
LOG_FILE="/var/log/rclone/rclone-$(date +%Y-%m-%d).log"
|
|
|
|
|
|
-
|
|
|
|
{% if backups is defined and 'containers' in backups %}
|
|
{% if backups is defined and 'containers' in backups %}
|
|
{% if containers is defined %}
|
|
{% if containers is defined %}
|
|
{% for container in containers %}
|
|
{% for container in containers %}
|
|
{% if container.volumes is defined %}
|
|
{% if container.volumes is defined %}
|
|
{% for volume in container.volumes %}
|
|
{% for volume in container.volumes %}
|
|
-echo "Starting backup of container '{{ container.service_name }}' volume '{{ volume | regex_replace(':.*') }}'." | ts >> "$LOG_FILE"
|
|
|
|
|
|
+{% if backups_ignore not in volume|regex_replace(':.*') %}
|
|
|
|
+echo "Starting backup of '{{ container.service_name }}:{{ volume | regex_replace(':.*') }}'." | ts >> "$LOG_FILE"
|
|
/usr/bin/rclone copy {{ volume | regex_replace(':.*') }}/ b2-container-data:current/{{ ansible_hostname }}/{{ container.service_name }}/{{ volume | regex_replace(':.*') | basename }} \
|
|
/usr/bin/rclone copy {{ volume | regex_replace(':.*') }}/ b2-container-data:current/{{ ansible_hostname }}/{{ container.service_name }}/{{ volume | regex_replace(':.*') | basename }} \
|
|
--backup-dir=b2-container-data:old/{{ ansible_hostname }}/{{ container.service_name }}/{{ volume | regex_replace(':.*') | basename }} \
|
|
--backup-dir=b2-container-data:old/{{ ansible_hostname }}/{{ container.service_name }}/{{ volume | regex_replace(':.*') | basename }} \
|
|
--suffix=-$(date +%Y-%m-%d) \
|
|
--suffix=-$(date +%Y-%m-%d) \
|
|
@@ -18,8 +17,9 @@ echo "Starting backup of container '{{ container.service_name }}' volume '{{ vol
|
|
--suffix-keep-extension \
|
|
--suffix-keep-extension \
|
|
--exclude "*log" \
|
|
--exclude "*log" \
|
|
--log-file="$LOG_FILE" -v
|
|
--log-file="$LOG_FILE" -v
|
|
-echo "Finished backup of container '{{ container.service_name }}' volume '{{ volume | regex_replace(':.*') }}'." | ts >> "$LOG_FILE"
|
|
|
|
|
|
+echo "Finished backup of '{{ container.service_name }}:{{ volume | regex_replace(':.*') }}'." | ts >> "$LOG_FILE"
|
|
|
|
|
|
|
|
+{% endif %}
|
|
{% endfor %}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endfor %}
|