Wrap up B2 setup

This commit is contained in:
Wojciech Kozlowski 2019-12-14 23:04:28 +01:00
parent c353f45612
commit f1ee132038
4 changed files with 11 additions and 2 deletions

View File

@ -7,4 +7,4 @@ B2_BUCKET="loki-backup"
# GPG key (last 8 characters) # GPG key (last 8 characters)
GPG_KEY="{{ gpg_key_id }}" GPG_KEY="{{ gpg_key_id }}"
PASSPHRASE="{{ gpg_passphrase }}" GPG_PASSPHRASE="{{ gpg_passphrase }}"

View File

@ -97,6 +97,10 @@
apt: apt:
name: duplicity name: duplicity
- name: Install B2 backend for duplicity
pip:
name: b2
- name: Create GitLab credentials file - name: Create GitLab credentials file
template: template:
src: ./gitlab.cred.j2 src: ./gitlab.cred.j2

View File

@ -13,4 +13,4 @@
tasks: tasks:
- name: Install python2 - name: Install python2
raw: apt-get -y install python raw: apt-get -y install python python-pip python-setuptools

View File

@ -9,6 +9,11 @@ export PASSPHRASE=${GPG_PASSPHRASE}
# Local directory to backup # Local directory to backup
LOCAL_DIR="/media/usb0/backup" LOCAL_DIR="/media/usb0/backup"
# Remove files older than 30 days
duplicity remove-older-than 30D --force \
--encrypt-sign-key $GPG_KEY \
b2://${B2_ACCOUNT}:${B2_KEY}@${B2_BUCKET}
# Perform a full backup # Perform a full backup
duplicity full \ duplicity full \
--encrypt-sign-key $GPG_KEY \ --encrypt-sign-key $GPG_KEY \