/
backup.yaml
62 lines (53 loc) · 1.88 KB
/
backup.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
# Install restic and sets up systemd timer to perform scheduled backup
#
- hosts: truenas
become: true
vars:
restic_version: 0.16.3
restic_path: /usr/local/bin/restic
restic_user: root
restic_folders:
- {
path: '/mnt/mega/photos',
exclude: '--exclude="/mnt/mega/photos/immich/thumbs" --exclude="/mnt/mega/photos/immich/encoded-video"',
}
- { path: '/mnt/mega/aditya' }
restic_default_folders: [] # don't backup the default folders
restic_ssh_enabled: false
restic_repository: /home/admin/seagate/backups
restic_repository_name: /home/admin/seagate/backups
restic_systemd_timer_on_calender: '*-*-* 03:00:00'
pre_tasks:
- name: Download restic
ansible.builtin.get_url:
url: 'https://github.com/restic/restic/releases/download/v{{ restic_version }}/restic_{{ restic_version }}_linux_amd64.bz2'
dest: '/tmp/restic_{{ restic_version }}_linux_amd64.bz2'
- name: Extract restic
command: 'bzip2 -dk /tmp/restic_{{ restic_version }}_linux_amd64.bz2'
args:
creates: '/tmp/restic_{{ restic_version }}_linux_amd64'
- name: Install restic
ansible.builtin.copy:
remote_src: true
src: '/tmp/restic_{{ restic_version }}_linux_amd64'
dest: '{{ restic_path }}'
mode: 0755
roles:
- ansible-restic
- ansible-rclone
tasks:
- name: sync arch backups to b2 on Tuesday & Friday
ansible.builtin.cron:
name: 'sync arch backups to b2'
minute: '0'
hour: '1'
weekday: '2,5'
job: 'rclone sync /home/admin/backups/arch b2:{{b2_arch_backup}}'
- name: Sync nas backups to b2 on Wednesday & Saturday
ansible.builtin.cron:
name: 'sync nas backups to b2'
minute: '0'
hour: '1'
weekday: '3,6'
job: 'rclone sync /home/admin/seagate/backups b2:{{b2_nas_backup}}'