Ansible VMware Connection Plugin & Become

When using VMware as the connection plugin to connect to remote hosts you commonly set two facts for username and password:

ansible_vmware_tools_user: "mkamner"
ansible_vmare_tools_password: "Super Secret PW"

This will work just fine for windows and with many tasks on linux.

However, if you want to use become: true on linux it will fail with the strangest error messages.

For example: apt will fail, because it can’t acquire the lock file

The solution is rather simple, become does not honor the VMware facts set, instead it wants two different facts set:

ansible_user: "mkamner"
ansible_password: "Super Secret PW"

See also