
This was never consistently showing the host key and sshfp records upon launch. Upon digging, a number of things are going wrong. The socket.create_connection() check isn't waiting for the host to be up properly. This means the keyscans were not working, and we'd get blank return values [1]. We have a ssh_connect() routine, rework it to use that to probe. We add a close method to the sshclient so we can shut it down too. I don't know why the inventory output was in dns.py, as it's not really DNS. Move it to the main launch_node.py, and simplify it by using f-strings. While we're here, deliminate the output a bit more and make white-space more consistent. This allows us to simplify dns.py and make it so it handles multiple domains. Since we're actually waiting for ssh to be up now, the keyscan works better and this outputs the information we want. A sample of this is https://paste.opendev.org/show/b1MjiTvYr4E03GTeP56w/ [1] ssh-keyscan has a very short timeout, and just returns blank if it doesn't get a response to it's probes. We weren't checking its return code. Change-Id: I06995027a4b80133bdac91c263d7a92fd495493b
Create Server
The commands in this section should be run as root on the bastion host.
To launch a node in the OpenStack CI account (production servers):
export OS_CLOUD=openstackci-rax
export OS_REGION_NAME=DFW
export FLAVOR="8 GB Performance"
export FQDN=servername01.opendev.org
/usr/launcher-venv/bin/launch-node $FQDN --flavor "$FLAVOR" \
--cloud=$OS_CLOUD --region=$OS_REGION_NAME
Manually add the hostname to DNS (the launch script does not do so
automatically, but it prints the commands to run). Note that for
*.opendev.org hosts you'll only be able to add the reverse dns records
via the printed commands. Forward A and AAAA records should be added to
opendev/zone-opendev.org/zones/opendev.org/zone.db
.
We need to add the host to our static inventory file so that the
ansible runs see the new host. The launch script prints out the
appropriate lines to add to
opendev/system-config:inventory/openstack.yaml
.
In order for Ansible to work, you also need to accept the root SSH
key for the new server. Once the new DNS entries have propagated, as
root
on the bastion server:
ssh root@$FQDN
Verify the fingerprint of the new server and type "yes" to accept. Then you can log out.
Add DNS Records
The launch-node script will print the commands needed to be run to configure DNS for a newly launched server. To see the commands for an existing server, run:
/usr/launcher-venv/bin/show-dns $FQDN