Set mount option for given mount point with ansible
I managed to get what I want with the json_query
filter:
- name: "mount options for /"
mount:
path: "/"
src: "UUID={{ ansible_mounts | json_query('[?mount == `/`] | [0].uuid') }}"
fstype: "ext4"
opts: "errors=remount-ro,noatime,user_xattr,acl"
state: "present"
You will need to install the package python-jmespath
.