dig lookup multiple hosts

Hey all - I’m trying to lookup the IPs for a list of FQDNs. The dig lookup is close to what I need, but it appears to return a list of IPs for a single FQDN; when using with_items, it yields each of the IPs for that FQDN (https://docs.ansible.com/ansible/2.5/plugins/lookup/dig.html). Any idea how I can use with_items to iterate over the list of FQDNs and store the resulting list of IPs?

Something sort of like:

I'm might misunderstand you question, but if you turn it around I think get your answer

  - debug: msg='IP for {{ item }} is {{ lookup('dig', item) }}'
    with_items: "{{ db_hosts }}"

Thanks Kai. That worked. I think I don’t quite understand lookup plugins (aside from with_items). I’ll keep researching.

Rob