From decd9e8710d9f322c454f595539fc7b61ad8ab84 Mon Sep 17 00:00:00 2001 From: Florian Apolloner Date: Thu, 17 Sep 2015 12:23:58 +0200 Subject: [PATCH] Only use become if the target user difers from the current remote user. --- lib/ansible/plugins/action/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/plugins/action/__init__.py b/lib/ansible/plugins/action/__init__.py index e1dbad17013..b161c8f9d20 100644 --- a/lib/ansible/plugins/action/__init__.py +++ b/lib/ansible/plugins/action/__init__.py @@ -453,7 +453,7 @@ class ActionBase: self._display.debug("no command, exiting _low_level_execute_command()") return dict(stdout='', stderr='') - if sudoable and self._play_context.become: + if sudoable and self._play_context.become and self._play_context.become_user != self._play_context.remote_user: self._display.debug("using become for this command") cmd = self._play_context.make_become_cmd(cmd, executable=executable)