From 5bd52796ec71852beb5846127b14093661ec0075 Mon Sep 17 00:00:00 2001 From: Steve Weber Date: Fri, 1 Nov 2013 14:19:33 -0400 Subject: [PATCH] dont sudo if sudo_user is the same as the active user --- lib/ansible/runner/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) 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 ]: