Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Arch Linux
infrastructure
Commits
bb35582a
Verified
Commit
bb35582a
authored
Jun 30, 2020
by
Sven-Hendrik Haase
Browse files
Adjust backup host paths to new scheme
parent
764df6ee
Changes
6
Hide whitespace changes
Inline
Side-by-side
host_vars/gitlab.archlinux.org
View file @
bb35582a
...
...
@@ -7,3 +7,4 @@ zabbix_agent_templates:
- Template App HTTPS Service
- Template App Nginx
- Template App SSH Service
gitlab_backupdir: /srv/gitlab/data/backups
playbooks/all-hosts-basic.yml
View file @
bb35582a
---
-
name
:
basic setup for all hosts
hosts
:
all,!rsync_net
hosts
:
all,!
hetzner_storageboxes,!
rsync_net
remote_user
:
root
roles
:
-
{
role
:
common
}
...
...
roles/borg-client/defaults/main.yml
View file @
bb35582a
---
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"
roles/borg-client/tasks/main.yml
View file @
bb35582a
...
...
@@ -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
:
"
"
...
...
roles/borg-client/templates/borg-backup.sh.j2
View file @
bb35582a
...
...
@@ -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
"
...
...
roles/borg-client/templates/borg.j2
View file @
bb35582a
#!/bin/bash
BORG_REPO
=
"{{ item['host'] }}
:
{{ item['dir'] }}"
exec
/usr/bin/borg
"
$@
"
BORG_REPO
=
"{{ item['host'] }}
/
{{ item['dir'] }}"
exec
/usr/bin/borg
"
$@
"
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment