Ansible can't sudo to unprivileged user

Hello,

I have a use case where ansible has to connect with an automation user, which is deployed on all the servers, and the sudo to a service user that runs on that particular machine. The service users are all different between these machines and are unprivileged users.

So ansible is having a issue with that. I just tried to do a whoami using the shell module, for a simple test.
I get back: Shared connection closed.

Setfacl is installed and POSIX acls are available. I tested and as the connection user I could add an rw acl for the service user. So ansible should be able to do it.

These users also share a group so I tried setting ansible_common_remote_group. It didn’t help.
I tried setting allow_world_readable_tmpfiles. That didn’t help either.

So I am a bit at a loss here. By all means, it seems this should work, but for some reason it doesn’t and I’m not sure what to check next.

Best regards,
Adrian

"doesn't work" isn't really helpful for debugging, while exact error
output (preferably with -vvv) would go a long way to see what the
issue really is.

'shared connection closed' is the 'generic' response from the sshd
services on the remote, you might want to see the sshd logging
(probably need to up the verbosity) to see exactly whay.