Good day.
I have a sudo user(user1) on the server and i need to run a task as another unprivilleged user(user2). A dont know a password for user2 and regular way to run something as user2 that login as user1 run “sudo -i”, run “su user2” and run something else.
And now a qestion, how can i do this in play book?
You can't stack multiple sudo/su in Ansible.
But if you can run "sudo -u user2 <command>" as user1 then you can use Ansible to make it work.