I'm still bugged I can't figure this out.
I can make a list of all components easily enough too
- name: make a list of the components
set_fact:
components: "{{ components|default([]) |union( item.value) }}"
with_dict: "{{ components_by_group }}"
I haven't figured a way to create more output key=value pairs than their are input items, so it would likely be useful to use the list of components in a with_items. But then I am stuck trying to lookup the group that the component belongs to.
If you could pass a list as the second arg to with_subelements that would let you loop through all the components in each of the groups and add them to an output, but with_subelements only takes a string for its second arg.
I even wondered about using with_cartesian on the components and groups lists and only adding to the output when group and component match components_by_group but I think you just get a single flat list with the cartesian product in it.
Any suggestions - devious or elegant - would be gratefully appreciated.
Jon