mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Update lib/ansible/utils/__init__.py
Adds -i to make_sudo_cmd so target user's environment gets loaded when configurationslike this are used : - hosts: ubuntu name: Install ruby for the configured ruby user sudo: True sudo_user: rubyuser # should be ${ruby_user}, but can't for now because of #1665 tasks: - name: Gets current ruby version action: shell rbenv version register: ruby_current_version
This commit is contained in:
parent
f86974fdae
commit
87f6739e20
1 changed files with 1 additions and 1 deletions
|
@ -544,6 +544,6 @@ def make_sudo_cmd(sudo_user, executable, cmd):
|
|||
# the -p option.
|
||||
randbits = ''.join(chr(random.randint(ord('a'), ord('z'))) for x in xrange(32))
|
||||
prompt = '[sudo via ansible, key=%s] password: ' % randbits
|
||||
sudocmd = 'sudo -k && sudo -S -p "%s" -u %s %s -c %s' % (
|
||||
sudocmd = 'sudo -k && sudo -S -p "%s" -i -u %s %s -c %s' % (
|
||||
prompt, sudo_user, executable or '$SHELL', pipes.quote(cmd))
|
||||
return ('/bin/sh -c ' + pipes.quote(sudocmd), prompt)
|
||||
|
|
Loading…
Reference in a new issue