1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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
templar = Templar(loader=self._loader, shared_loader_obj=self._shared_loader_obj, variables=variables)
if self._task.evaluate_conditional(templar, variables):
final_items.append(item)
return [",".join(final_items)]
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)
joined_items = ",".join(final_items)
self._task.args['name'] = joined_items
return [joined_items]
else:
return items