diff --git a/config/ansible/tasks/servers/zfs.yml b/config/ansible/tasks/servers/zfs.yml index 6ca2be9..90cde02 100644 --- a/config/ansible/tasks/servers/zfs.yml +++ b/config/ansible/tasks/servers/zfs.yml @@ -9,19 +9,26 @@ ansible.builtin.command: modprobe zfs become: true +- name: Ensure /mnt directory exists with proper permissions + ansible.builtin.file: + path: /mnt + state: directory + mode: "0755" + become: true + - name: Create mount points ansible.builtin.file: path: "{{ item }}" state: directory mode: "0755" - owner: menno - group: users + become: true with_items: - /mnt/isos - /mnt/vms - /mnt/ai - /mnt/astrophotography - /mnt/audiobooks + - /mnt/backups - /mnt/backups/photos - /mnt/backups/services - /mnt/downloads @@ -56,3 +63,29 @@ - { path: /mnt/services, src: datapool/services } - { path: /mnt/stash, src: datapool/stash } - { path: /mnt/tvshows, src: datapool/tv_shows } + +- name: Set ownership after mounting + ansible.builtin.file: + path: "{{ item }}" + state: directory + recurse: false + mode: "0755" + owner: menno + group: users + become: true + with_items: + - /mnt/isos + - /mnt/vms + - /mnt/ai + - /mnt/astrophotography + - /mnt/audiobooks + - /mnt/backups/photos + - /mnt/backups/services + - /mnt/downloads + - /mnt/movies + - /mnt/music + - /mnt/old_backups + - /mnt/photos + - /mnt/services + - /mnt/stash + - /mnt/tvshows