mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
Allow raw and script to support su
This commit is contained in:
parent
ae1b183855
commit
7e3dd1066c
2 changed files with 7 additions and 5 deletions
|
@ -113,12 +113,13 @@ class ActionModule(object):
|
|||
|
||||
sudoable = True
|
||||
# set file permissions, more permisive when the copy is done as a different user
|
||||
if self.runner.sudo and self.runner.sudo_user != 'root':
|
||||
if ((self.runner.sudo and self.runner.sudo_user != 'root') or
|
||||
(self.runner.su and self.runner.su_user != 'root')):
|
||||
cmd_args_chmod = "chmod a+rx %s" % tmp_src
|
||||
sudoable = False
|
||||
else:
|
||||
cmd_args_chmod = "chmod +rx %s" % tmp_src
|
||||
self.runner._low_level_exec_command(conn, cmd_args_chmod, tmp, sudoable=sudoable)
|
||||
self.runner._low_level_exec_command(conn, cmd_args_chmod, tmp, sudoable=sudoable, su=self.runner.su)
|
||||
|
||||
# add preparation steps to one ssh roundtrip executing the script
|
||||
env_string = self.runner._compute_environment_string(inject)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue