From 18d00b32dee59f957cedb3ce73799cedb1bf4347 Mon Sep 17 00:00:00 2001 From: yohan <783b8c87@scimetis.net> Date: Sat, 19 Oct 2024 22:27:21 +0200 Subject: [PATCH] Fix bug with disk mounts being mixed on reboot. --- tasks/main.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 8236fdd..9223a60 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -46,12 +46,13 @@ dev: "{{ volume_output.attachments[0].device }}" become: true +# Device names can change on reboot, we need to get UUID from Ansible facts. - setup: -- debug: var=ansible_facts + - name: mount /mnt/volumes/{{ volume.name }} ansible.posix.mount: path: "/mnt/volumes/{{ volume.name }}" - src: "{{ ansible_facts['ansible_device_links']['uuids'][volume_output.attachments[0].device.split('/')[-1]][0] }}" + src: "UUID={{ ansible_facts['device_links']['uuids'][volume_output.attachments[0].device.split('/')[-1]][0] }}" fstype: ext4 state: mounted become: true