I have such a variable:
apps:
- {name: kapitalism, extension: .war}
- {name: socialism, extension: .war}
- {name: somethingelse, extension: .ear}
And I need to make another one based on it, which will not include some of the list. I'm trying this:
- name: Reject this please
set_fact:
apps: "{{ apps | map(attribute='name') | reject('search',item.name) | list }}"
when: "item.name.find('socialism') != -1"
with_items: "{{ apps }}"
But here I get such a problem that the extension parameter is lost and I get the variable:
apps: [u'kapitalism', u'somethingelse']
How to make a variable like this:
apps:
- {name: kapitalism, extension: .war}
- {name: somethingelse, extension: .ear}
?