From 4f6d4c6bf6a2e9eec06d965520c6e3a637e14201 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Thu, 5 Nov 2015 08:37:39 -0800 Subject: [PATCH] Set task_action when the action does not need to be templated Fixes #13042 --- lib/ansible/executor/task_executor.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/ansible/executor/task_executor.py b/lib/ansible/executor/task_executor.py index ac6d4095e0..c3c6821700 100644 --- a/lib/ansible/executor/task_executor.py +++ b/lib/ansible/executor/task_executor.py @@ -235,8 +235,9 @@ class TaskExecutor: # that aren't available until later (it could even use vars from the # with_items loop) so don't make the templated string permanent yet. templar = Templar(loader=self._loader, shared_loader_obj=self._shared_loader_obj, variables=variables) - if templar._contains_vars(self._task.action): - task_action = templar.template(self._task.action, fail_on_undefined=False) + task_action = self._task.action + if templar._contains_vars(task_action): + task_action = templar.template(task_action, fail_on_undefined=False) if len(items) > 0 and task_action in self.SQUASH_ACTIONS: if all(isinstance(o, string_types) for o in items):