Switch user without root
If the individual id on the target host can switch to functional id but cannot switch to root user how to switch to functional id using Ansible.
Tried below code but it is not working:
become: yes
become_user: apache
with below error
FAILED! => {"changed": false, "module_stderr": "Shared connection to ab.c.d closed.\r\n", "module_stdout": "sudo: a password is required\r\n", "msg": "MODULE FAILURE", "rc": 1}
but on the server individual id can switch to apache user without entering password.
I tried without "become: yes" also it is not working.
Tried using become_method as su also but not working.
Please advice.