More on setting up Openstack Ansible

Since I wrote this blog post in December 2015, things have been changing in the openstack-ansible world. Here I will describe an ‘all command line’ method for setting up a cloud server in the Rackspace Public Cloud and go through the steps necessary to get an All In One Openstack installation running.

This will include installing and setting up a command line tool for bringing up server instances, getting logged in to a new server instance, obtaining openstack-ansible, making some small configuration adjustments and using openstack-ansible to set up an ‘All in One’ Openstack setup.

The rack tool

Command line provisioning of cloud servers in the Rackspace public cloud may be accomplished using the rack tool available for MacOSX, Linux and Windows from the Rackspace Developer site.

To use the tool, you’ll need to have an account on mycloud.rackspace.com and to set up the tool you’ll need your username and API key from that account.

Follow the installation instructions on the developer site to get the rack tool set up for your operating system.

Before you create a server

Once you have created a server, you will want to ssh in to it to set up Openstack. You could just use ssh with a password, but it’s entirely possible that the Openstack installation process will disable password logins (hint: It will) so you’d be well advised to set things up so that you can log in with an ssh key instead.

If you already have an ssh keypair available, you’re ready to use the racker tool to add the public key to your mycloud account so that it can be automatically installed in your cloud servers. If you don’t, or if you’re not quite sure how to go about making a keypair, the nice folks at github have some great instructions for doing that.

With your public key living at ~/.ssh/id_rsa.pub, you can:

rack servers keypair upload --file ~/.ssh/id_rsa.pub --name mi_key
Name		mi_key
Fingerprint	e6:bb:27:21:b8:6a:d8:17:04:c6:26:56:a8:bc:ef:b6
PublicKey	ssh-rsa <snipped the actual key>

This will give your public key the name mi_key and upload it to your mycloud account, ready to use when you create servers. Choose your own name for the key when you upload it.

Creating a server

A couple of things that you’ll need to know before you create a server are an image name which will determine your server’s base operating system and a flavor which will determine its memory, disk and CPU characteristics. The racker tool includes some useful commands to help you decide which image and flavor you want to use.
To work out what system images are available, use:

rack servers image list

And to work out what flavors are available:

rack servers flavor list

Having run these commands to determine what options are available, I can now create a server with:

rack servers instance create --name myserver --image-name "Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)" --flavor-id io1-15 --keypair mi_key

Once the command has run, you’ll see an ID for the server and a root admin password (which you may want to copy) and you should be able to see details of the new server via your list of servers with:

rack servers instance list | grep myserver

Your ssh key should already be installed on the new server so using the IP address revealed by the list:

ssh root@<server.ip.address>

Preparing the system

The Ubuntu 14.04 image will benefit from some package upgrades, so start out by doing that:

apt-get update && apt-get upgrade -y

And you’ll need a couple of extra tools set up:

apt-get install git tmux

The tmux tool lets you set up a session that will keep going if you lose your network connection. This command will create a session called ‘admin’ that you can later re-connect to with the tmux attach -t admin command.

tmux new -s admin

Next get a copy of the openstack-ansible code using git:

git clone https://git.openstack.org/openstack/openstack-ansible /opt/openstack-ansible

The procedure for kicking off ansible has changed slightly since the last time I wrote about it. Start with:

cd /opt/openstack-ansible

If you have a need to run a version of Openstack earlier than the very latest, select the version you want now.

git tag

From the list of git tags, choose the one you want to use. Substitute it for TAG in the following command:

git checkout TAG

Then get things going with:

scripts/bootstrap-ansible.sh

It’s important to have quite a lot of disk available to set this up. This requires a config change:

sed -i '/#bootstrap_host_data_disk_device:/c\bootstrap_host_data_disk_device: xvde' tests/roles/bootstrap-host/defaults/main.yml

Now the openstack setup can run:

scripts/bootstrap-aio.sh
scripts/run-playbooks.sh

This will need an hour or more to run. Once it completes, you should be able to see all of the lxc containers running Openstack services on your server with:

lxc-ls -f

3 thoughts on “More on setting up Openstack Ansible

Comments are closed.