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-mount
|
||||||
- zfs-import.target
|
- 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
|
- name: Ensure /mnt directory exists with proper permissions
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: /mnt
|
path: /mnt
|
||||||
state: directory
|
state: directory
|
||||||
mode: "0755"
|
mode: "0755"
|
||||||
become: true
|
become: true
|
||||||
|
when: datapool_check.rc == 0
|
||||||
|
|
||||||
- name: Create mount points
|
- name: Create mount points
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
@ -50,6 +58,7 @@
|
|||||||
- /mnt/services
|
- /mnt/services
|
||||||
- /mnt/stash
|
- /mnt/stash
|
||||||
- /mnt/tvshows
|
- /mnt/tvshows
|
||||||
|
when: datapool_check.rc == 0
|
||||||
|
|
||||||
- name: Mount ZFS datasets
|
- name: Mount ZFS datasets
|
||||||
become: true
|
become: true
|
||||||
@ -72,6 +81,7 @@
|
|||||||
- { path: /mnt/services, src: datapool/services }
|
- { path: /mnt/services, src: datapool/services }
|
||||||
- { path: /mnt/stash, src: datapool/stash }
|
- { path: /mnt/stash, src: datapool/stash }
|
||||||
- { path: /mnt/tvshows, src: datapool/tv_shows }
|
- { path: /mnt/tvshows, src: datapool/tv_shows }
|
||||||
|
when: datapool_check.rc == 0
|
||||||
|
|
||||||
- name: Set ownership after mounting
|
- name: Set ownership after mounting
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
@ -96,3 +106,4 @@
|
|||||||
- /mnt/services
|
- /mnt/services
|
||||||
- /mnt/stash
|
- /mnt/stash
|
||||||
- /mnt/tvshows
|
- /mnt/tvshows
|
||||||
|
when: datapool_check.rc == 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user