I am attempting to use VMWare as a dynamic inventory for awx. It seems like VMWare/vSphere does not always provide the correct IP address for servers with multiple network adapters, such as docker hosts. In multiple cases in my environment VMWare has returned the a bridge IP rather then the primary server IP:
for example:
9: tun0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue state UNKNOWN qlen 1000
link/ether de:2b:b1:bc:6b:43 brd ff:ff:ff:ff:ff:ff
inet 10.131.0.1/23 scope global tun0
valid_lft forever preferred_lft forever
inet6 fe80::dc2b:b1ff:febc:6b43/64 scope link
valid_lft forever preferred_lft forever
Since I cannot depend on the IP address, how can I force ansible to use the returned hostname instead.
This is probably better addressed on the ansible vmware inventory module itself or through your vmware service configuration rather than on AWX. You can adjust it by removing ansible_hostname from the host's inventory vars (and making sure you don't have "overwrite vars" selected.
How would I do that within AWX? Other than going into each host and removing it manually? Since this is an auto-generating inventory and I don't control how many adapters a VM has that would seem to be an unmaintainable solution...
I also had to remove the ansible_ssh_host variable...
I found the solution:
host_pattern: "{{ guest.hostname }}" had to be added to the config to override the default which is the IP address...
can you please tell me where have you done that change ?