I have two nics on my vm. One for normal network operations, another dedicated to our SAN. When my VMWare source adds the vm to the inventory, the ansible_host value is set to the ip of the SAN nic. As is ansible_ssh_host.
DNS is configured to use the normal network nic’s ip address.
We take some free-form configuration in the source_vars section of the inventory source so if you can figure out what specific value is needed for host_pattern to resolve what you want then you can put that in the “Source Vars” section of the Inventory Source when you are defining it.
Unfortunately I don’t use a lot of vmware so I can’t help you figure out exactly what you need but the ini file I linked to should provide a good starting place. The ansible vmware inventory module uses pyvmomi behind the scenes which is a python interface to the vmware soap interface.
We take some free-form configuration in the source_vars section of the inventory source so if you can figure out what specific value is needed for host_pattern to resolve what you want then you can put that in the “Source Vars” section of the Inventory Source when you are defining it.
Ah, I hadn’t seen the host_pattern key. Thanks.
Now, to figure out what to put there…
The correct ip isn’t even listed in the hosts variables section when I view that in the inventory. So, I somehow need to figure out a way to get info from both network cards into a place I can use it…