summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclarkzjw <[email protected]>2023-02-08 00:40:09 -0800
committerclarkzjw <[email protected]>2023-02-08 00:40:09 -0800
commit1204730924436ef9e1c7c49c9557837f9a5ed0e8 (patch)
tree129d79dfd11245751cee6d4082ff5d2f6e941610 /ansible/roles/backup/tasks
parent9635ac4dedf69de5bff65785bcc16bef80b52d75 (diff)
downloadmail-1204730924436ef9e1c7c49c9557837f9a5ed0e8.tar.gz
fork https://github.com/mattsta/mailwebHEADmaster
Diffstat (limited to 'ansible/roles/backup/tasks')
-rw-r--r--ansible/roles/backup/tasks/main.yml40
1 files changed, 40 insertions, 0 deletions
diff --git a/ansible/roles/backup/tasks/main.yml b/ansible/roles/backup/tasks/main.yml
new file mode 100644
index 0000000..fedc68b
--- /dev/null
+++ b/ansible/roles/backup/tasks/main.yml
@@ -0,0 +1,40 @@
1---
2- name: install borgbackup
3 apt:
4 pkg: borgbackup
5 state: latest
6
7- name: install borgmatic
8 pip:
9 name: borgmatic
10 state: latest
11
12- name: create backup config dir
13 file:
14 path: /etc/borgmatic.d
15 owner: "{{ backup.runAs }}"
16 mode: 0700
17 state: directory
18
19# Create backup config for entire server
20# Ideally we only have one type of data to backup per server and the rest
21# can be re-constructed as necessary through auto-deploy processes
22- name: populate borgmatic config with details for hosts
23 template:
24 src: borgmatic.yml.j2
25 dest: /etc/borgmatic.d/system.backup.yml
26 owner: "{{ backup.runAs }}"
27 mode: 0600
28
29# Note: right now we aren't populating an 'excludes' file
30# If we need 'excludes' in the future, append '--excludes [excludesDirsFile]'
31# ALSO NOTE: your backup.runAs user MUST MANUALLY ACCEPT THE BACKUP HOST SSH KEY
32# Backup will stall if unattended ssh sees new host fingerprint needing approval
33- name: install backup crontab
34 cron:
35 name: "Backup Offsite"
36 minute: 32
37 hour: 3
38 job: "borgmatic --verbosity 1 -c /etc/borgmatic.d/system.backup.yml"
39 user: "{{ backup.runAs }}"
40 cron_file: backup_offsite
Powered by cgit v1.2.3 (git 2.41.0)