Commit e9d8f063 by James Cammarata

Merge pull request #7143 from sivel/ansible-sudo-from-root-fix

Allow sudo to another user from root with the ansible command
parents 2bc640c8 eb875917
......@@ -933,13 +933,13 @@ class Runner(object):
# compare connection user to (su|sudo)_user and disable if the same
if hasattr(conn, 'user'):
if conn.user == sudo_user or conn.user == su_user:
if (not su and conn.user == sudo_user) or (su and conn.user == su_user):
sudoable = False
su = False
else:
# assume connection type is local if no user attribute
this_user = getpass.getuser()
if this_user == sudo_user or this_user == su_user:
if (not su and this_user == sudo_user) or (su and this_user == su_user):
sudoable = False
su = False
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment