I'm trying to read fstab and update any entry that uses "LABEL=" to use the UUID instead..
I can get the proper UUID mappings, but I can't seem to wrap my head around the actual replacement...
playbook:
- name: Gather UUID mappings
shell: "blkid -s UUID -o value -t LABEL={{item}}"
with_items:
- "/home"
- "/var"
- "/"
ignore_errors: true
register: "UUID"
- name: Convert fstab LABEL entries to UUID format
replace:
dest=/etc/fstab
regexp='LABEL={{ item }}'
replace='UUID={{UUID.item}}'
backup=yes
with_items:
- "/"
- "/home"
- "/var"
For the highlighted lines, what should I be using - or is there a better way (I've looked at the mount module, but didn't see a way to do this)