diff options
| author | Ahmed Abdelhalim <[email protected]> | 2026-07-19 00:23:36 +0200 |
|---|---|---|
| committer | Ahmed Abdelhalim <[email protected]> | 2026-07-19 00:23:36 +0200 |
| commit | 457ea6648783258458bb12280d39d5816450ff62 (patch) | |
| tree | d1f7375ede93c47710fab15d2fb973e0f5bfdf86 /roles | |
| parent | 11e661babdb681924d902cbf193ed248dd88c039 (diff) | |
Rename backup -> mount as a role
Diffstat (limited to 'roles')
| -rw-r--r-- | roles/backup/defaults/main.yml | 4 | ||||
| -rw-r--r-- | roles/backup/tasks/main.yml | 18 | ||||
| -rw-r--r-- | roles/mount/README.md (renamed from roles/backup/README.md) | 16 | ||||
| -rw-r--r-- | roles/mount/defaults/main.yml | 4 | ||||
| -rw-r--r-- | roles/mount/meta/argument_specs.yml (renamed from roles/backup/meta/argument_specs.yml) | 14 | ||||
| -rw-r--r-- | roles/mount/meta/main.yml (renamed from roles/backup/meta/main.yml) | 2 | ||||
| -rw-r--r-- | roles/mount/tasks/main.yml | 18 |
7 files changed, 38 insertions, 38 deletions
diff --git a/roles/backup/defaults/main.yml b/roles/backup/defaults/main.yml deleted file mode 100644 index 6fc18f9a..00000000 --- a/roles/backup/defaults/main.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -backup_mount_point: "/backup" -backup_fstype: "ext4" -backup_mount_options: "defaults,noatime" diff --git a/roles/backup/tasks/main.yml b/roles/backup/tasks/main.yml deleted file mode 100644 index 2180d659..00000000 --- a/roles/backup/tasks/main.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -- 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" diff --git a/roles/backup/README.md b/roles/mount/README.md index 62cada76..c82c777a 100644 --- a/roles/backup/README.md +++ b/roles/mount/README.md @@ -1,25 +1,25 @@ -# Backup Role +# Mount Role -Mounts a dedicated backup drive on the target host. +Mounts a drive on the target host. ## Overview -Prepares a dedicated storage device as the local backup destination S3-compatible object store (ex. Garage). +Prepares a storage device as a mount point (e.g. local backup destination for S3-compatible object store like Garage). ## Configuration ### Required Variables ```yaml -backup_device: "PARTLABEL=backup" # no default — must set in host_vars +mount_device: "PARTLABEL=backup" # no default — must set in host_vars ``` ### Optional Variables ```yaml -backup_mount_point: "/backup" -backup_fstype: "ext4" -backup_mount_options: "defaults,noatime" +mount_point: "/backup" +mount_fstype: "ext4" +mount_options: "defaults,noatime" ``` ## Preparing the Drive @@ -63,7 +63,7 @@ ls /dev/disk/by-partlabel/ In `host_vars/rpi5.local.yml`: ```yaml -backup_device: "PARTLABEL=backup" +mount_device: "PARTLABEL=backup" ``` `PARTLABEL` is stable across reboots regardless of device enumeration order (`/dev/sda` vs `/dev/sdb`). diff --git a/roles/mount/defaults/main.yml b/roles/mount/defaults/main.yml new file mode 100644 index 00000000..325e0e51 --- /dev/null +++ b/roles/mount/defaults/main.yml @@ -0,0 +1,4 @@ +--- +mount_point: "/backup" +mount_fstype: "ext4" +mount_options: "defaults,noatime" diff --git a/roles/backup/meta/argument_specs.yml b/roles/mount/meta/argument_specs.yml index 459187ee..e74c1610 100644 --- a/roles/backup/meta/argument_specs.yml +++ b/roles/mount/meta/argument_specs.yml @@ -2,19 +2,19 @@ argument_specs: main: options: - backup_device: + mount_device: type: "str" description: "Device to mount (e.g. PARTLABEL=backup)" required: true - backup_mount_point: + mount_point: type: "str" - description: "Mount point for the backup drive" + description: "Mount point for the drive" default: "/mnt/backup" - backup_fstype: + mount_fstype: type: "str" - description: "Filesystem type of the backup device" + description: "Filesystem type of the device" default: "ext4" - backup_mount_options: + mount_options: type: "str" - description: "Mount options for the backup device" + description: "Mount options for the device" default: "defaults,noatime" diff --git a/roles/backup/meta/main.yml b/roles/mount/meta/main.yml index 616d6a42..ccb8c2a9 100644 --- a/roles/backup/meta/main.yml +++ b/roles/mount/meta/main.yml @@ -2,7 +2,7 @@ dependencies: [] galaxy_info: author: "a14m" - description: "Mount a dedicated backup drive" + description: "Mount a drive" license: "MIT" min_ansible_version: "2.18" platforms: diff --git a/roles/mount/tasks/main.yml b/roles/mount/tasks/main.yml new file mode 100644 index 00000000..65e40416 --- /dev/null +++ b/roles/mount/tasks/main.yml @@ -0,0 +1,18 @@ +--- +- name: "Create mount point" + become: true + ansible.builtin.file: + path: "{{ mount_point }}" + state: "directory" + owner: "root" + group: "root" + mode: "0755" + +- name: "Mount drive" + become: true + ansible.posix.mount: + path: "{{ mount_point }}" + src: "{{ mount_device }}" + fstype: "{{ mount_fstype }}" + opts: "{{ mount_options }}" + state: "mounted" |
