mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-11 16:44:22 -07:00
Always run the accelerate module as the user specified in the play
Currently, the accelerate daemon will be run as the sudo_user if specified, which is incorrect.
This commit is contained in:
parent
f04af9118e
commit
4bf506f683
1 changed files with 8 additions and 1 deletions
|
@ -349,7 +349,14 @@ class Runner(object):
|
||||||
if not self.sudo or self.sudo_user == 'root':
|
if not self.sudo or self.sudo_user == 'root':
|
||||||
# not sudoing or sudoing to root, so can cleanup files in the same step
|
# not sudoing or sudoing to root, so can cleanup files in the same step
|
||||||
cmd = cmd + "; rm -rf %s >/dev/null 2>&1" % tmp
|
cmd = cmd + "; rm -rf %s >/dev/null 2>&1" % tmp
|
||||||
res = self._low_level_exec_command(conn, cmd, tmp, sudoable=True)
|
|
||||||
|
sudoable = True
|
||||||
|
if module_name == "accelerate":
|
||||||
|
# always run the accelerate module as the user
|
||||||
|
# specified in the play, not the sudo_user
|
||||||
|
sudoable = False
|
||||||
|
|
||||||
|
res = self._low_level_exec_command(conn, cmd, tmp, sudoable=sudoable)
|
||||||
|
|
||||||
if self.sudo and self.sudo_user != 'root':
|
if self.sudo and self.sudo_user != 'root':
|
||||||
# not sudoing to root, so maybe can't delete files as that other user
|
# not sudoing to root, so maybe can't delete files as that other user
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue