Making the easy things easy, and the difficult things damn near impossible.

Inventory list merging

Say you need a set of lists from inventory merged into one list. Name the inventory lists X_my_list where X is something meaningful, then:

- name: "Collect lists"
  vars:
    my_list: []
  ansible.builtin.set_fact:
    my_list: "{{ log_ship_sources | union(lookup('vars', item)) }}"
  loop: "{{ hostvars[inventory_hostname] | select('match','^.*_my_list$') | list }}"