diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index a5a978d301f..ed68963523c 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -736,6 +736,10 @@ class Runner(object): executable = C.DEFAULT_EXECUTABLE sudo_user = self.sudo_user + + if self.remote_user == sudo_user: + sudoable = False + rc, stdin, stdout, stderr = conn.exec_command(cmd, tmp, sudo_user, sudoable=sudoable, executable=executable) if type(stdout) not in [ str, unicode ]: