`'ansible_mounts' is undefined` after a "speed up facts" change
IntermediateTroubleshootingVariables, Facts and Precedence Problems
Answer
Likely causes → gather_subset was reduced (for example to ['!all', 'min'] or ['!hardware']), and mounts, memory and devices are part of the hardware subset.
Diagnose → ansible web01 -m setup -a 'gather_subset=!all,min' | grep -c mounts returns 0.
Fix → Add back what the play needs:
gather_facts: true
gather_subset: [min, hardware]
Or call ansible.builtin.setup with that subset right before the task that needs it.
Prevent → Document which facts each role relies on, and test roles with the same gather_subset that production uses.
More on Variables, Facts and Precedence Problems
Variables in `group_vars/webservers.yml` are silently ignoredBeginnerYou set `nginx_port: 8443` in inventory `group_vars`, but the role still uses `80`Intermediate`set_fact: release_tag=v2` runs, but later tasks still see `v1`Intermediate`'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_default_ipv4'` when templating `hostvars['db01']`Intermediate`'ansible_eth0' is undefined` on new cloud instancesBeginnerFacts like `ansible_hostname` became undefined after someone changed `ansible.cfg`Intermediate