I have a situation where, we need to disable the “root” user. and need to make configuration changes to linux servers using a regular(cafe3) user which has sudo privileges.
To achieve that, I am ssh in to server using “cafe3” using ansible, and mentioning the --sudo flag while executing it.
Manual attempt-3:
If I ssh in to server using user as cafe3, and try to run command like “sudo ls”. It works fine.
It does ask me for sudo password and I provided the same password as I did in attempt-1 and attempt-2 above.
So I tried the command which you posted, still no success.
ansible all --inventory-file=inv_my.yaml -m setup -u cafe3 --ask-pass --ask-sudo-pass --sudo -vv
SSH password:
sudo password [defaults to SSH password]:
<vcac148-085-217.eng.vmware.com> REMOTE_MODULE setup vcac148-085-217.eng.vmware.com | FAILED => SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to help diagnose the issue
Please help me figure the problem with my usage or a workaround here.