diff --git a/roles/partitioning/tasks/extra_disks.yml b/roles/partitioning/tasks/extra_disks.yml index 5fdd392..db7f56b 100644 --- a/roles/partitioning/tasks/extra_disks.yml +++ b/roles/partitioning/tasks/extra_disks.yml @@ -7,7 +7,6 @@ | selectattr('mount.path') | list }} - changed_when: false - name: Validate additional disks do not target install_drive when: partitioning_extra_disks | length > 0 @@ -59,7 +58,15 @@ dev: "{{ item.partition }}" fstype: "{{ item.mount.fstype }}" opts: "{{ _all_opts }}" - force: true + loop: "{{ partitioning_extra_disks }}" + loop_control: + label: "{{ item.partition }}" + +- name: Collect extra disk UUIDs + when: partitioning_extra_disks | length > 0 + ansible.builtin.command: "blkid -s UUID -o value {{ item.partition }}" + register: partitioning_extra_disk_uuids + changed_when: false loop: "{{ partitioning_extra_disks }}" loop_control: label: "{{ item.partition }}" @@ -79,11 +86,11 @@ - name: Mount additional disks for fstab generation when: partitioning_extra_disks | length > 0 ansible.posix.mount: - path: "/mnt{{ item.mount.path }}" - src: "{{ item.partition }}" - fstype: "{{ item.mount.fstype }}" - opts: "{{ item.mount.opts | default('defaults') }}" + path: "/mnt{{ item.0.mount.path }}" + src: "UUID={{ item.1.stdout }}" + fstype: "{{ item.0.mount.fstype }}" + opts: "{{ item.0.mount.opts | default('defaults') }}" state: mounted - loop: "{{ partitioning_extra_disks }}" + loop: "{{ partitioning_extra_disks | zip(partitioning_extra_disk_uuids.results) | list }}" loop_control: - label: "{{ item.mount.path }}" + label: "{{ item.0.mount.path }}"