mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-05 05:34:22 -07:00
Allow sudo to another user from root
This commit is contained in:
parent
d88ac5e24d
commit
eb8759176f
1 changed files with 2 additions and 2 deletions
|
@ -933,13 +933,13 @@ class Runner(object):
|
||||||
|
|
||||||
# compare connection user to (su|sudo)_user and disable if the same
|
# compare connection user to (su|sudo)_user and disable if the same
|
||||||
if hasattr(conn, 'user'):
|
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
|
sudoable = False
|
||||||
su = False
|
su = False
|
||||||
else:
|
else:
|
||||||
# assume connection type is local if no user attribute
|
# assume connection type is local if no user attribute
|
||||||
this_user = getpass.getuser()
|
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
|
sudoable = False
|
||||||
su = False
|
su = False
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue