Add ability to select to prefer IPv4 addresses for ansible_ssh_host (#35584)

Currently Cloudforms can return a mix of IPv4 and IPv6 addresses in the
ipaddresses field and this mix comes in a "random" order (that is the
first entry may be IPv4 sometimes but IPv6 other times). If you wish to
always use IPv4 for the ansible_ssh_host value then this is problematic.

This change adds a new prefer_ipv4 flag which will look for the first
IPv4 address in the ipaddresses list and uses that instead of just the
first entry.
This commit is contained in:
Richard Bywater
2018-02-02 02:33:51 +11:00
committed by Sam Doran
parent fe067040d1
commit 7dbcf752c8
2 changed files with 17 additions and 1 deletions

View File

@@ -31,6 +31,9 @@ nest_tags = False
# Note: This suffix *must* include the leading '.' as it is appended to the hostname as is
# suffix = .example.org
# If true, will try and use an IPv4 address for the ansible_ssh_host rather than just the first IP address in the list
prefer_ipv4 = False
[cache]
# Maximum time to trust the cache in seconds