From 65fdcf8b9df93a7804e35203c119c593f919f7e7 Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Tue, 30 Jun 2015 10:13:40 -0500 Subject: [PATCH] Check for name or pkg when templating squashed items. Fixes #11430 --- lib/ansible/executor/task_executor.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ansible/executor/task_executor.py b/lib/ansible/executor/task_executor.py index 8405389593b..1f46b0c705a 100644 --- a/lib/ansible/executor/task_executor.py +++ b/lib/ansible/executor/task_executor.py @@ -179,15 +179,15 @@ class TaskExecutor: Squash items down to a comma-separated list for certain modules which support it (typically package management modules). ''' - if len(items) > 0 and self._task.action in self.SQUASH_ACTIONS: final_items = [] for item in items: variables['item'] = item templar = Templar(loader=self._loader, shared_loader_obj=self._shared_loader_obj, variables=variables) if self._task.evaluate_conditional(templar, variables): - if templar._contains_vars(self._task.args['name']): - new_item = templar.template(self._task.args['name']) + name = self._task.args.pop('name', None) or self._task.args.pop('pkg', None) + if templar._contains_vars(name): + new_item = templar.template(name) final_items.append(new_item) else: final_items.append(item)