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:
---
- hosts: all
vars:
db_hosts=['host1.example.com', 'host2.example.com']
tasks:
- debug: msg='IP is {{ item }}'
with_items: "{{ lookup('dig', 'BLAH', wantlist=False) }}"
but what to put in for BLAH if I want to get the IPs for the list given by
db_hosts?
Rob
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/3e773d4d-c77a-4dd7-b751-b008c5de3ae7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.