restore-from-b2.sh.j2 727 B

12345678910111213141516171819202122232425
  1. #!/bin/bash
  2. # {{ ansible_managed }}
  3. {% if backups is defined and 'containers' in backups %}
  4. {% if containers is defined %}
  5. {% for container in containers %}
  6. {% if container.volumes is defined %}
  7. {% for volume in container.volumes %}
  8. {% if volume|regex_replace(':.*') not in backups_ignore %}
  9. BACKUP_DIR='/opt/restores{{ volume | regex_replace(':.*') }}'
  10. echo "Starting restore of '{{ container.name }}:{{ volume | regex_replace(':.*') }} to $BACKUP_DIR'..."
  11. /usr/bin/rclone copy b2-container-data:current/{{ ansible_hostname }}/{{ container.name }}/{{ volume | regex_replace(':.*') | basename }} "$BACKUP_DIR" \
  12. --fast-list \
  13. --progress
  14. echo
  15. echo
  16. {% endif %}
  17. {% endfor %}
  18. {% endif %}
  19. {% endfor %}
  20. {% endif %}
  21. {% endif %}