summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.yml1
-rw-r--r--host_vars/rpi5.local.ymlbin2359 -> 2390 bytes
-rw-r--r--host_vars/rpi5.local.yml.example2
-rw-r--r--roles/backup/defaults/main.yml4
-rw-r--r--roles/backup/meta/argument_specs.yml20
-rw-r--r--roles/backup/meta/main.yml11
-rw-r--r--roles/backup/tasks/main.yml18
7 files changed, 56 insertions, 0 deletions
diff --git a/configure.yml b/configure.yml
index ec7e34cb..7bfc5fb9 100644
--- a/configure.yml
+++ b/configure.yml
@@ -105,6 +105,7 @@
- role: "prometheus-node-exporter"
- role: "grafana"
- role: "neomutt"
+ - role: "backup"
- name: "Proxmox VE configure"
gather_facts: true
diff --git a/host_vars/rpi5.local.yml b/host_vars/rpi5.local.yml
index 356a1076..4a366424 100644
--- a/host_vars/rpi5.local.yml
+++ b/host_vars/rpi5.local.yml
Binary files differ
diff --git a/host_vars/rpi5.local.yml.example b/host_vars/rpi5.local.yml.example
index 95308832..1b6eb4fd 100644
--- a/host_vars/rpi5.local.yml.example
+++ b/host_vars/rpi5.local.yml.example
@@ -74,3 +74,5 @@ grafana_dashboards:
datasource_mappings:
- key: "${DS__VICTORIAMETRICS}"
value: "prometheus"
+
+backup_device: "/dev/sda2"
diff --git a/roles/backup/defaults/main.yml b/roles/backup/defaults/main.yml
new file mode 100644
index 00000000..cbf9e76e
--- /dev/null
+++ b/roles/backup/defaults/main.yml
@@ -0,0 +1,4 @@
+---
+backup_mount_point: "/mnt/backup"
+backup_fstype: "ext4"
+backup_mount_options: "defaults,noatime"
diff --git a/roles/backup/meta/argument_specs.yml b/roles/backup/meta/argument_specs.yml
new file mode 100644
index 00000000..259173c1
--- /dev/null
+++ b/roles/backup/meta/argument_specs.yml
@@ -0,0 +1,20 @@
+---
+argument_specs:
+ main:
+ options:
+ backup_device:
+ type: "str"
+ description: "Block device to mount (e.g. /dev/sda1)"
+ required: true
+ backup_mount_point:
+ type: "str"
+ description: "Mount point for the backup drive"
+ default: "/mnt/backup"
+ backup_fstype:
+ type: "str"
+ description: "Filesystem type of the backup device"
+ default: "ext4"
+ backup_mount_options:
+ type: "str"
+ description: "Mount options for the backup device"
+ default: "defaults,noatime"
diff --git a/roles/backup/meta/main.yml b/roles/backup/meta/main.yml
new file mode 100644
index 00000000..616d6a42
--- /dev/null
+++ b/roles/backup/meta/main.yml
@@ -0,0 +1,11 @@
+---
+dependencies: []
+galaxy_info:
+ author: "a14m"
+ description: "Mount a dedicated backup drive"
+ license: "MIT"
+ min_ansible_version: "2.18"
+ platforms:
+ - name: "Debian"
+ versions:
+ - "bookworm"
diff --git a/roles/backup/tasks/main.yml b/roles/backup/tasks/main.yml
new file mode 100644
index 00000000..2180d659
--- /dev/null
+++ b/roles/backup/tasks/main.yml
@@ -0,0 +1,18 @@
+---
+- name: "Create backup mount point"
+ become: true
+ ansible.builtin.file:
+ path: "{{ backup_mount_point }}"
+ state: "directory"
+ owner: "root"
+ group: "root"
+ mode: "0755"
+
+- name: "Mount backup drive"
+ become: true
+ ansible.posix.mount:
+ path: "{{ backup_mount_point }}"
+ src: "{{ backup_device }}"
+ fstype: "{{ backup_fstype }}"
+ opts: "{{ backup_mount_options }}"
+ state: "mounted"