ref(playbook): Change to role-based structure

This commit is contained in:
Marty Oehme 2025-02-28 20:57:34 +01:00
parent 95fd68bed8
commit b3b280fbe4
Signed by: Marty
GPG key ID: 4E535BC19C61886E
39 changed files with 635 additions and 601 deletions

View file

@ -0,0 +1,5 @@
- name: Set up snapper snapshots
import_tasks: snapper.yaml
tags:
- btrfs
- snapshots

View 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