Don't set the host's name as UUID

It looks like we solved the duplicate server problem twice in
conflicting ways. Using uuid in the inventory is not needed, bcause
we're making a specific inventory for the ansible commands and avoiding
the OpenStack inventory. So the ansible run has no idea of any other
servers other than the one we're making right now. With that, we can use
name as the hostname rather than UUID.

Story: 2000520
Change-Id: Idb967e10fc00471923077e4e9caa32fdb4c1cc78
This commit is contained in:
Monty Taylor 2016-03-22 12:14:04 -05:00
parent f7ae87c072
commit 9e678eeb8e

View File

@ -94,12 +94,12 @@ def bootstrap_server(server, key, name, volume, keep):
# Write out inventory
inventory_file = tempfile.NamedTemporaryFile(delete=not keep)
inventory_file.write("{host} ansible_host={ip} ansible_user=root".format(
host=server.id, ip=server.interface_ip))
host=name, ip=server.interface_ip))
inventory_file.flush()
ansible_cmd = [
'ansible-playbook',
'-i', inventory_file.name, '-l', server.id,
'-i', inventory_file.name, '-l', name,
'--private-key={key}'.format(key=key_file.name),
"--ssh-common-args='-o StrictHostKeyChecking=no'",
'-e', 'target={id}'.format(id=server.id),