(New to ansible) I'm running ansible all -m setup
on a handful of hosts to produce JSON output for our inventory system. Some of our ansible remotes are in different subnets (DMZs for instance). I'd like to include the LAN IP associated with these hosts in the ansible JSON output. How can I do this?
UPDATE: To clarify, I would like the 192.168.1.1
ip address to be in the fact output somehow. The ansible_all_ipv4_addresses
field and ansible_default_ipv4
in the output contains 10.10.10.1
which isn't a helpful IP address to people looking at the inventory from a LAN perspective.
192.168.1.0/24 192.168.1.0/24
LAN ----------------FIREWALL
| |
eth0 eth1
| |
| +-------DMZ1---------+
| |
host1.org.net > + eth0:1=192.168.1.1 + 10.10.10.1 > host1.org.net
| |
host2.org.net > + eth0:2=192.168.1.2 + 10.10.10.2 > host2.org.net