Privilege escalation not working for non-root users

Latest response

We have a usecase where we need to provide ansible access to database teams and we don't want to give root access to them. We had a service account created in the control node and password-less authentication is enabled to other servers. We had sudo access provided to the service account on the remote servers and it works perfectly.
We have a playbook and we mentioned become directive in the control node, but on the remote server, playbook/commands aren't properly executed with this code and getting sudo password error.
become: true
become_user: someone

TASK [test : Local user] ********************************************************************************************************************************************
task path: /apps/ansible/roles/test/tasks/create_logs.yml:1
changed: [hostname] => {"changed": true, "cmd": "id", "delta": "0:00:00.004199", "end": "2022-01-31 22:59:10.520185", "rc": 0, "start": "2022-01-31 22:59:10.515986", "stderr": "", "stderr_lines": [], "stdout": "uid=20302(serviceaccount) gid=20302(serviceaccount) groups=20302(serviceaccount)", "stdout_lines": ["uid=20302(serviceaccount) gid=20302(serviceaccount) groups=20302(serviceaccount)"]}

TASK [test : Remote user] *******************************************************************************************************************************************
task path: /apps/ansible/roles/test/tasks/create_logs.yml:5
fatal: [hostname]: FAILED! => {"msg": "Missing sudo password"}

Is it some kind of limitation in ansible open source ? Any other options you can suggest in this case.

Responses