summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2026-06-22 12:41:26 +0200
committerAhmed Abdelhalim <[email protected]>2026-06-22 12:52:06 +0200
commit1f9af83bafedc45659b422032c30b8204c7414aa (patch)
tree321219a31365be84ca27ebbf3dbd6f5dbccfb9ae /roles
parentf4977c88f9bef271fdb7f4e972c2a6dfa8124d33 (diff)
Add backup role for mounting a backup device on a rpi machine
Diffstat (limited to 'roles')
-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
4 files changed, 53 insertions, 0 deletions
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"