how to run task as unprivileged user

24 views
Skip to first unread message

Павел Марченко

unread,
Apr 20, 2017, 10:29:47 AM4/20/17
to Ansible Project
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?

Kai Stian Olstad

unread,
Apr 20, 2017, 12:59:08 PM4/20/17
to ansible...@googlegroups.com
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.

--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages