Use public_v4 addr when ignoring ipv6
In our launch node script we have the option to ignore ipv6 to deal with clouds like ovh that report an ipv6 address but don't actually provide that data to the instance so it cannot configure ipv6. When we ignore ipv6 we should not try to use the ipv6 address at all. Use the public_v4 address in this case when writing out an ansible inventory to run the base.yaml playbook when launching the node. Otherwise we could use ipv6 which doesn't work. Change-Id: I2ce5cc0db9852d3426828cf88965819f88b3ebd5
This commit is contained in:
parent
cb2976a976
commit
b1de301261
@ -160,11 +160,16 @@ def bootstrap_server(server, key, name, volume_device, keep,
|
||||
key.write_private_key(key_file)
|
||||
os.chmod(jobdir.key, 0o600)
|
||||
|
||||
if ignore_ipv6:
|
||||
host_ip = server.public_v4
|
||||
else:
|
||||
host_ip = server.interface_ip
|
||||
|
||||
# Write out inventory
|
||||
with open(jobdir.hosts, 'w') as inventory_file:
|
||||
inventory_file.write(
|
||||
"{host} ansible_host={ip} ansible_user=root {python}".format(
|
||||
host=name, ip=server.interface_ip,
|
||||
host=name, ip=host_ip,
|
||||
python='ansible_python_interpreter=/usr/bin/python3'))
|
||||
|
||||
t = threading.Thread(target=stream_syslog, args=(ssh_client,))
|
||||
|
Loading…
x
Reference in New Issue
Block a user