diff options
| author | Ahmed Abdelhalim <[email protected]> | 2026-06-22 12:41:26 +0200 |
|---|---|---|
| committer | Ahmed Abdelhalim <[email protected]> | 2026-06-22 12:52:06 +0200 |
| commit | 1f9af83bafedc45659b422032c30b8204c7414aa (patch) | |
| tree | 321219a31365be84ca27ebbf3dbd6f5dbccfb9ae | |
| parent | f4977c88f9bef271fdb7f4e972c2a6dfa8124d33 (diff) | |
Add backup role for mounting a backup device on a rpi machine
| -rw-r--r-- | configure.yml | 1 | ||||
| -rw-r--r-- | host_vars/rpi5.local.yml | bin | 2359 -> 2390 bytes | |||
| -rw-r--r-- | host_vars/rpi5.local.yml.example | 2 | ||||
| -rw-r--r-- | roles/backup/defaults/main.yml | 4 | ||||
| -rw-r--r-- | roles/backup/meta/argument_specs.yml | 20 | ||||
| -rw-r--r-- | roles/backup/meta/main.yml | 11 | ||||
| -rw-r--r-- | roles/backup/tasks/main.yml | 18 |
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 Binary files differindex 356a1076..4a366424 100644 --- a/host_vars/rpi5.local.yml +++ b/host_vars/rpi5.local.yml 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" |
