I'm using ansible with vagrant and ansible is trying to sudo as postgres user to run some postgres commands.
Ansible running as vagrant user seems to run something like sudo -u postgres psql
This fails with error message Missing sudo password
I ssh onto the vm using the same vagrant user and try sudo -u postgres psql
and sure enought it prompts for a password. Interestingly though, sudo su postgres
switches to the postgres user without password.
Why would sudo -u
require password when sudo su
doesn't?
There is an entry in /etc/sudoers.d/ called vagrant that has the following contents:
%vagrant ALL=NOPASSWD:ALL