Compare commits
2 Commits
a6e4beefb3
...
7d180f337d
Author | SHA1 | Date |
---|---|---|
Jef Roosens | 7d180f337d | |
Jef Roosens | 1afca6be94 |
|
@ -0,0 +1,2 @@
|
||||||
|
t5_uuid: 'b3b60b45-0bd2-42ac-a8d8-35a44fbd2529'
|
||||||
|
elements_uuid: '5D19-E5D1'
|
|
@ -25,6 +25,9 @@
|
||||||
|
|
||||||
# General compression tools
|
# General compression tools
|
||||||
- bzip2
|
- bzip2
|
||||||
|
|
||||||
|
# Working with BTRFS file systems
|
||||||
|
- btrfs-progs
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Ensure cron service is enabled
|
- name: Ensure cron service is enabled
|
||||||
|
|
|
@ -6,7 +6,7 @@ snapshot_dir="${data_dir}.snapshot"
|
||||||
# Read-only snapshot for atomic backup
|
# Read-only snapshot for atomic backup
|
||||||
btrfs subvolume snapshot -r "$data_dir" "$snapshot_dir" || exit $?
|
btrfs subvolume snapshot -r "$data_dir" "$snapshot_dir" || exit $?
|
||||||
|
|
||||||
restic backup "$snapshot_dir"
|
/usr/local/bin/restic backup "$snapshot_dir"
|
||||||
|
|
||||||
# Always remove snapshot subvolume, even if restic fails
|
# Always remove snapshot subvolume, even if restic fails
|
||||||
btrfs subvolume delete "$snapshot_dir"
|
btrfs subvolume delete "$snapshot_dir"
|
||||||
|
|
|
@ -53,4 +53,4 @@
|
||||||
name: 'Perform nightly backups'
|
name: 'Perform nightly backups'
|
||||||
minute: '0'
|
minute: '0'
|
||||||
hour: '2'
|
hour: '2'
|
||||||
job: 'bash /etc/backups/backup-all.sh'
|
job: '/usr/bin/bash /etc/backups/backup-all.sh'
|
||||||
|
|
|
@ -9,9 +9,9 @@ export RESTIC_REPOSITORY='rest:http://{{ groups['nas'][0] }}:8000/backups'
|
||||||
export RESTIC_PASSWORD_FILE='/etc/backups/restic_backups_passwd'
|
export RESTIC_PASSWORD_FILE='/etc/backups/restic_backups_passwd'
|
||||||
|
|
||||||
for script in $(find /etc/backups -name '*.backup.sh'); do
|
for script in $(find /etc/backups -name '*.backup.sh'); do
|
||||||
bash "$script"
|
/usr/bin/bash "$script"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Prune older backups
|
# Prune older backups
|
||||||
restic forget --keep-last 7 && \
|
/usr/local/bin/restic forget --keep-last 7 && \
|
||||||
restic prune
|
/usr/local/bin/restic prune
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
---
|
||||||
|
- name: Ensure ExFAT tools are present
|
||||||
|
apt:
|
||||||
|
name:
|
||||||
|
- exfat-fuse
|
||||||
|
- exfatprogs
|
||||||
|
state: present
|
||||||
|
|
||||||
|
# - name: Ensure mountpoints are present
|
||||||
|
# file:
|
||||||
|
# path: "{{ item.path }}"
|
||||||
|
# state: directory
|
||||||
|
# mode: '0755'
|
||||||
|
# owner: debian
|
||||||
|
# group: debian
|
||||||
|
# with_items:
|
||||||
|
# - path: '/mnt/data1'
|
||||||
|
# - path: '/mnt/data2'
|
||||||
|
|
||||||
|
- name: Ensure T5 BTRFS is mounted
|
||||||
|
mount:
|
||||||
|
path: /mnt/data1
|
||||||
|
src: "UUID={{ t5_uuid }}"
|
||||||
|
fstype: btrfs
|
||||||
|
state: mounted
|
||||||
|
|
||||||
|
- name: Ensure Elements ExFAT is mounted
|
||||||
|
mount:
|
||||||
|
path: /mnt/data2
|
||||||
|
src: "UUID={{ elements_uuid }}"
|
||||||
|
fstype: exfat
|
||||||
|
state: mounted
|
Loading…
Reference in New Issue