feat: add check for datapool existence before creating mount points and setting permissions
Some checks failed
Nix Format Check / check-format (push) Failing after 37s
Some checks failed
Nix Format Check / check-format (push) Failing after 37s
This commit is contained in:
parent
ae1241c10e
commit
5c905cde20
@ -23,12 +23,20 @@
|
||||
- zfs-mount
|
||||
- zfs-import.target
|
||||
|
||||
- name: Check if datapool exists
|
||||
ansible.builtin.command: zpool list datapool
|
||||
register: datapool_check
|
||||
ignore_errors: true
|
||||
become: true
|
||||
changed_when: false
|
||||
|
||||
- name: Ensure /mnt directory exists with proper permissions
|
||||
ansible.builtin.file:
|
||||
path: /mnt
|
||||
state: directory
|
||||
mode: "0755"
|
||||
become: true
|
||||
when: datapool_check.rc == 0
|
||||
|
||||
- name: Create mount points
|
||||
ansible.builtin.file:
|
||||
@ -50,6 +58,7 @@
|
||||
- /mnt/services
|
||||
- /mnt/stash
|
||||
- /mnt/tvshows
|
||||
when: datapool_check.rc == 0
|
||||
|
||||
- name: Mount ZFS datasets
|
||||
become: true
|
||||
@ -72,6 +81,7 @@
|
||||
- { path: /mnt/services, src: datapool/services }
|
||||
- { path: /mnt/stash, src: datapool/stash }
|
||||
- { path: /mnt/tvshows, src: datapool/tv_shows }
|
||||
when: datapool_check.rc == 0
|
||||
|
||||
- name: Set ownership after mounting
|
||||
ansible.builtin.file:
|
||||
@ -96,3 +106,4 @@
|
||||
- /mnt/services
|
||||
- /mnt/stash
|
||||
- /mnt/tvshows
|
||||
when: datapool_check.rc == 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user