Add task for backup
This commit is contained in:
parent
5087cbca6d
commit
6564f78511
@ -14,6 +14,7 @@
|
|||||||
- docker
|
- docker
|
||||||
- laptop
|
- laptop
|
||||||
- desktop
|
- desktop
|
||||||
|
- backup
|
||||||
|
|
||||||
# - flutter
|
# - flutter
|
||||||
# - virtual
|
# - virtual
|
||||||
|
13
roles/backup/files/etc/btrbk/btrbk.conf
Normal file
13
roles/backup/files/etc/btrbk/btrbk.conf
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
timestamp_format long
|
||||||
|
|
||||||
|
snapshot_preserve_min 24h
|
||||||
|
snapshot_preserve 7d 4w 3m
|
||||||
|
|
||||||
|
volume /home
|
||||||
|
snapshot_dir /home/.snapshots
|
||||||
|
subvolume /home
|
||||||
|
|
||||||
|
volume /
|
||||||
|
snapshot_dir /.snapshot_dir
|
||||||
|
subvolume /
|
||||||
|
|
2
roles/backup/files/etc/cron.daily/btrbk
Executable file
2
roles/backup/files/etc/cron.daily/btrbk
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
exec /usr/bin/btrbk -q run
|
29
roles/backup/tasks/arch.yml
Normal file
29
roles/backup/tasks/arch.yml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
- name: install btrbk
|
||||||
|
become: yes
|
||||||
|
community.general.pacman:
|
||||||
|
name:
|
||||||
|
- btrfs-progs
|
||||||
|
- btrbk
|
||||||
|
- cronie
|
||||||
|
|
||||||
|
- name: "Enable cron"
|
||||||
|
become: yes
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
name: cronie
|
||||||
|
state: started
|
||||||
|
enabled: yes
|
||||||
|
|
||||||
|
- name: Copy configuration
|
||||||
|
become: yes
|
||||||
|
copy:
|
||||||
|
src: etc/btrbk/btrbk.conf
|
||||||
|
dest: /etc/btrbk/btrbk.conf
|
||||||
|
mode: 0644
|
||||||
|
|
||||||
|
- name: Add cron daily
|
||||||
|
become: yes
|
||||||
|
copy:
|
||||||
|
src: etc/cron.daily/btrbk
|
||||||
|
dest: /etc/cron.daily/btrbk
|
||||||
|
mode: 0755
|
3
roles/backup/tasks/main.yml
Normal file
3
roles/backup/tasks/main.yml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
- import_tasks: arch.yml
|
||||||
|
when: ansible_distribution == "Archlinux"
|
Loading…
Reference in New Issue
Block a user