diff --git a/lib/ansible/utils/__init__.py b/lib/ansible/utils/__init__.py index 87637d40f0..8e5a6b5b3f 100644 --- a/lib/ansible/utils/__init__.py +++ b/lib/ansible/utils/__init__.py @@ -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)