From a4abf8da797a302ba43caaf2737fed986ac9f791 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 7 Sep 2016 12:12:41 -0400 Subject: [PATCH] Flush cache (#17445) * transfer module based on pipelining, not tmp fixes #17381 * added missing flush cache option back --- lib/ansible/cli/playbook.py | 5 +++++ lib/ansible/plugins/action/__init__.py | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/ansible/cli/playbook.py b/lib/ansible/cli/playbook.py index ec3a91776e..d2d8864b60 100644 --- a/lib/ansible/cli/playbook.py +++ b/lib/ansible/cli/playbook.py @@ -148,6 +148,11 @@ class PlaybookCLI(CLI): # Invalid limit raise AnsibleError("Specified --limit does not match any hosts") + # flush fact cache if requested + if self.options.flush_cache: + for host in inventory.list_hosts(): + variable_manager.clear_facts(host) + # create the playbook executor, which manages running the plays via a task queue manager pbex = PlaybookExecutor(playbooks=self.args, inventory=inventory, variable_manager=variable_manager, loader=loader, options=self.options, passwords=passwords) diff --git a/lib/ansible/plugins/action/__init__.py b/lib/ansible/plugins/action/__init__.py index efe0e869cb..2addc597a7 100644 --- a/lib/ansible/plugins/action/__init__.py +++ b/lib/ansible/plugins/action/__init__.py @@ -615,7 +615,12 @@ class ActionBase(with_metaclass(ABCMeta, object)): if not tmp and self._late_needs_tmp_path(tmp, module_style): tmp = self._make_tmp_path(remote_user) - if tmp: + if tmp and \ + (module_style != 'new' or \ + not self._connection.has_pipelining or \ + not self._play_context.pipelining or \ + C.DEFAULT_KEEP_REMOTE_FILES or \ + self._play_context.become_method == 'su'): remote_module_filename = self._connection._shell.get_remote_filename(module_path) remote_module_path = self._connection._shell.join_path(tmp, remote_module_filename) if module_style in ('old', 'non_native_want_json', 'binary'):