Allow squashed loop items to use name=foo-{{item}}

Fixes #9235
Fixes #11184
This commit is contained in:
James Cammarata 2015-06-26 10:54:38 -04:00
parent 9911a947ed
commit b723f9a09a

View file

@ -186,8 +186,14 @@ class TaskExecutor:
variables['item'] = item variables['item'] = item
templar = Templar(loader=self._loader, shared_loader_obj=self._shared_loader_obj, variables=variables) templar = Templar(loader=self._loader, shared_loader_obj=self._shared_loader_obj, variables=variables)
if self._task.evaluate_conditional(templar, variables): if self._task.evaluate_conditional(templar, variables):
if templar._contains_vars(self._task.args['name']):
new_item = templar.template(self._task.args['name'])
final_items.append(new_item)
else:
final_items.append(item) final_items.append(item)
return [",".join(final_items)] joined_items = ",".join(final_items)
self._task.args['name'] = joined_items
return [joined_items]
else: else:
return items return items