Skip to content

Commit a0fea08

Browse files
committed
mystamps-backup: configure cron to backup data to a remote host by using duplicity.
Fix #418
1 parent cb6f8a1 commit a0fea08

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# /etc/cron.d/mystamps-backup-remote file for backuping my-stamps.ru data to remote host
2+
MAILTO=coder
3+
#
4+
# min hour dom mon dow user command
5+
45 0 * * * mystamps duplicity --name=uploads --no-compression --no-encryption /data/uploads {{ uploads_target_url }} 2>&1
6+
50 0 * * * mystamps PASSPHRASE='{{ gpg_passphrase }}' duplicity --name=mysql-backups --no-compression /data/backups {{ mysql_backups_target_url }} 2>&1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
11
---
22
user_db_password: p@ssword
3+
# Target urls should be in a format that is supported by duplicity(1):
4+
# http://www.nongnu.org/duplicity/duplicity.1.html#sect7
5+
uploads_target_url: file:///tmp/uploads
6+
mysql_backups_target_url: file:///tmp/mysql-backups
7+
# Passphrase for GPG to encrypt archives
8+
gpg_passphrase:

vagrant/provisioning/roles/mystamps-backup/tasks/main.yml

+30
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,33 @@
3333
path: /etc/cron.d/mystamps
3434
state: absent
3535

36+
- name: Installing duplicity
37+
apt:
38+
package: duplicity
39+
state: present
40+
41+
- name: Creating /etc/duplicity directory
42+
file:
43+
path: /etc/duplicity
44+
state: directory
45+
owner: root
46+
group: root
47+
mode: '0755'
48+
49+
- name: Downloading /etc/duplicity/cacert.pem
50+
command: curl https://curl.haxx.se/ca/cacert.pem -o cacert.pem
51+
args:
52+
chdir: /etc/duplicity
53+
creates: /etc/duplicity/cacert.pem
54+
warn: no
55+
56+
- name: Creating a cron task for backup to a remote host
57+
template:
58+
src: ../../src/main/config/cron/mystamps-backup-remote
59+
dest: /etc/cron.d/mystamps-backup-remote
60+
force: yes
61+
backup: no
62+
owner: root
63+
group: root
64+
mode: '0600'
65+

0 commit comments

Comments
 (0)