Awx: Using a vSphere Inventory, how do I force awx to use the hostname in the inventory rather than the IP address

Created on 3 Oct 2017  路  5Comments  路  Source: ansible/awx

ISSUE TYPE
  • Documentation
COMPONENT NAME
  • UI
SUMMARY

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.

ENVIRONMENT
  • AWX version: 1.0.0.561
  • AWX install method: openshift
  • Ansible version: X.Y.Z
  • Operating System: Centos
  • Web Browser: Chrome

All 5 comments

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 ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

IMOKURI picture IMOKURI  路  3Comments

shortsteps picture shortsteps  路  3Comments

beenje picture beenje  路  3Comments

marshmalien picture marshmalien  路  3Comments

cs35-owncloud picture cs35-owncloud  路  3Comments