ref(playbook): Change to role-based structure
This commit is contained in:
parent
95fd68bed8
commit
b3b280fbe4
39 changed files with 635 additions and 601 deletions
5
roles/backup/tasks/main.yaml
Normal file
5
roles/backup/tasks/main.yaml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
- name: Set up snapper snapshots
|
||||
import_tasks: snapper.yaml
|
||||
tags:
|
||||
- btrfs
|
||||
- snapshots
|
||||
67
roles/backup/tasks/snapper.yaml
Normal file
67
roles/backup/tasks/snapper.yaml
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
- name: Install snapper
|
||||
community.general.xbps:
|
||||
name:
|
||||
- snapper
|
||||
state: present
|
||||
|
||||
# https://wiki.archlinux.org/title/Snapper#updatedb
|
||||
- name: Disable updatedb indexing for snapshot directories
|
||||
ansible.builtin.copy:
|
||||
content: 'PRUNENAMES = ".snapshots"'
|
||||
dest: "/etc/updatedb.conf"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
force: true
|
||||
|
||||
- name: Ensure snapper configs directory exists
|
||||
ansible.builtin.file:
|
||||
dest: "/etc/snapper/configs"
|
||||
state: directory
|
||||
recurse: true
|
||||
|
||||
- name: Ensure root /.snapshots directory exists
|
||||
ansible.builtin.file:
|
||||
dest: "/.snapshots"
|
||||
state: directory
|
||||
mode: 0755
|
||||
|
||||
- name: Create root backup configuration
|
||||
ansible.builtin.template:
|
||||
src: snapper-configurations/root.j2
|
||||
dest: "/etc/snapper/configs/root"
|
||||
mode: 0640
|
||||
force: true # ensure contents are always exact
|
||||
|
||||
- name: Ensure home /.snapshots directory exists
|
||||
ansible.builtin.file:
|
||||
dest: "/home/.snapshots"
|
||||
state: directory
|
||||
mode: 0755
|
||||
|
||||
- name: Create homedir backup configuration
|
||||
ansible.builtin.template:
|
||||
src: snapper-configurations/home.j2
|
||||
dest: "/etc/snapper/configs/home"
|
||||
mode: 0640
|
||||
force: true
|
||||
|
||||
- name: Add snap manual safety command
|
||||
ansible.builtin.copy:
|
||||
src: snapper-snap-script
|
||||
dest: "/usr/bin/snap"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
|
||||
# For now we never activate the snapper daemon
|
||||
# Does not work without elogind?
|
||||
# Using snooze (i.e. cron) enabled recurring
|
||||
# backup tasks instead.
|
||||
# - name: Activate snapper service
|
||||
# ansible.builtin.file:
|
||||
# force: "yes"
|
||||
# src: "/etc/sv/snapperd"
|
||||
# dest: "/etc/runit/runsvdir/default/snapperd"
|
||||
# state: link
|
||||
# tags: never
|
||||
Loading…
Add table
Add a link
Reference in a new issue