Verified Commit bb35582a authored by Sven-Hendrik Haase's avatar Sven-Hendrik Haase
Browse files

Adjust backup host paths to new scheme

parent 764df6ee
......@@ -7,3 +7,4 @@ zabbix_agent_templates:
- Template App HTTPS Service
- Template App Nginx
- Template App SSH Service
gitlab_backupdir: /srv/gitlab/data/backups
---
- name: basic setup for all hosts
hosts: all,!rsync_net
hosts: all,!hetzner_storageboxes,!rsync_net
remote_user: root
roles:
- { role: common }
......
---
backup_hosts:
- host: "{{ hetzner_storagebox_username }}@u236610.your-storagebox.de"
dir: "backup/{{ inventory_hostname }}"
- host: "ssh://{{ hetzner_storagebox_username }}@u236610.your-storagebox.de:23"
dir: "~/backup/{{ inventory_hostname }}"
suffix: ""
- host: "{{ rsync_net_username }}@ch-s012.rsync.net"
dir: "backup/{{ inventory_hostname }}"
- host: "ssh://{{ rsync_net_username }}@ch-s012.rsync.net:22"
dir: "~/backup/{{ inventory_hostname }}"
suffix: "-offsite"
......@@ -7,14 +7,16 @@
template: src=borg-restore.cfg.j2 dest=/etc/borg-restore.cfg owner=root group=root mode=0644
- name: check if borg repository already exists
command: borg list {{ item['host'] }}:{{ item['dir'] }}
command: borg list {{ item['host'] }}/{{ item['dir'] }}
environment:
BORG_RELOCATED_REPO_ACCESS_IS_OK: "yes"
register: borg_list
ignore_errors: True
loop: "{{ backup_hosts }}"
changed_when: borg_list.stdout | length > 0
- name: init borg repository
command: borg init -e keyfile {{ item['host'] }}:{{ item['dir'] }}
command: borg init -e keyfile {{ item['host'] }}/{{ item['dir'] }}
when: borg_list is failed
environment:
BORG_PASSPHRASE: ""
......
......@@ -72,8 +72,8 @@ borg create -v --stats -C zstd \
-e "$backup_mountdir/var/lib/archbuild" \
-e "$backup_mountdir/var/lib/archbuilddest" \
-e "$backup_mountdir/var/lib/docker" \
{{ item['host'] }}:{{ item['dir'] }}::$(date "+%Y%m%d-%H%M%S") "$backup_mountdir"
borg prune -v {{ item['host'] }}:{{ item['dir'] }} --keep-daily=7 --keep-weekly=4 --keep-monthly=6
{{ item['host'] }}/{{ item['dir'] }}::$(date "+%Y%m%d-%H%M%S") "$backup_mountdir"
borg prune -v {{ item['host'] }}/{{ item['dir'] }} --keep-daily=7 --keep-weekly=4 --keep-monthly=6
if is_btrfs "$src"; then
umount -R "$backup_mountdir"
......
#!/bin/bash
BORG_REPO="{{ item['host'] }}:{{ item['dir'] }}" exec /usr/bin/borg "$@"
BORG_REPO="{{ item['host'] }}/{{ item['dir'] }}" exec /usr/bin/borg "$@"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment