I thought of a workaround, but also doesn't work:
- set_fact: item.target_name = item.name
when: item.target_name is not defined
with_items: configs
This way I could just always use item.target_name. It runs on the correct
items, but seems that set_fact doesn't work as I expected for an
I think what you want, is to use the 'default' filter.
Such as:
template: src={{ item.name }}.j2 dest=/etc/config/{{
item['target_name']|default(item.name) }}
with_items: configs
I also changed target_name to not use dot notation, as that can sometimes still
create issues with the default
I see, that worked fine, thanks.
On Wednesday, March 26, 2014 1:29:21 PM UTC, Matt Martz wrote:
I think what you want, is to use the 'default' filter.
Such as:
template: src={{ item.name }}.j2 dest=/etc/config/{{
item['target_name']|default(item.name) }}
with_items: configs
I also