Hi all,
I have a data-structure like the below that consists of few internal hostnames.
client_groups:
apache-servers:
- apa01-pco.web.vpn
- apa02-pco.web.vpn
- apa03-pco.web.vpn
mailout:
- mo11-pco.mail.vpn
- mo12-pco.mail.vpn
- mo13-pco.mail.vpn
These are provided in as vars. I’m trying to write a task that uses dig plugin to produce dicts of their respective A records like the below:
client_groups:
apache-servers:
- ‘10.5.10.111’
- ‘10.2.10.112’
- ‘10.5.10.11’
mailout:
- ‘1.2.3.4’
- ‘5.6.7.8’
So far, I’ve been able to write a task like the below:
pre_tasks:
- name: Setting log-client IPs
set_fact:
ip_addr: ‘{{ lookup(“dig”, item) }}’
with_flattened: ‘{{ client_groups }}’
register: dig_results
Please let me know what I am missing. Any hints would be helpful.