diff --git a/lib/ansible/runner/action_plugins/patch.py b/lib/ansible/runner/action_plugins/patch.py index ebd0c6cf59..29d4f7eca5 100644 --- a/lib/ansible/runner/action_plugins/patch.py +++ b/lib/ansible/runner/action_plugins/patch.py @@ -47,7 +47,10 @@ class ActionModule(object): else: src = utils.path_dwim(self.runner.basedir, src) - tmp_src = tmp + src + if tmp is None or "-tmp-" not in tmp: + tmp = self.runner._make_tmp_path(conn) + + tmp_src = conn.shell.join_path(tmp, os.path.basename(src)) conn.put_file(src, tmp_src) if self.runner.become and self.runner.become_user != 'root':