OpenStack

The usage of OpenStack is possible via the Public Cloud services, for our Public Cloud OS we will be doing this under Debian 8 (Jessie). We will first create the Public Cloud instance under this environment and create our very own SSH keys as the Public Cloud makes use of of SSH keys rather than SSH password.

One important factor is to remember which datacenter you have selected for our instance as this will be important later on for our OpenStack connection.

Our instance should be created in a few minutes and we should have the public SSH key in the instance and with the private SSH key on our local computer. By default the login is set as admin, rather than root. This means that our connection would be:

ssh admin@mysuperweb.co.uk

Once we have logged into our instance, one of the first things we will look to do is to check for any pending updates on the server. We can do this with:

admin@mysuperweb.co.uk:~$ sudo apt-get update
admin@mysuperweb.co.uk:~$ sudo apt-get upgrade

If we wish to make use of the root user permanently without the usage of sudo, we can run the following command:

admin@mysuperweb.co.uk:~$ sudo su
root@mysuperweb.co.uk:/home/admin#

OpenStack Horizon

The OpenStack Horizon login is located at:

https://horizon.cloud.ovh.net/auth/login/

Our login credentials can be found in the control panel interface. The usernames and passwords consist of random characters and values.

Once inside the Horizon, we can locate the “Access & Security” tab on the left side and then “API Access”. From here we will have the ability to download the OpenStack RC file. We will look to download this file and upload it our Public Cloud instance and calling the file as openrc.sh.

Here is an example file for openrc.sh, your file will differ.

openrc.sh


#!/bin/bash

# To use an Openstack cloud you need to authenticate against keystone, which
# returns a **Token** and **Service Catalog**.  The catalog contains the
# endpoint for all services the user/tenant has access to - including nova,
# glance, keystone, swift.
#
# *NOTE*: Using the 2.0 *auth api* does not mean that compute api is 2.0.  We
# will use the 1.1 *compute api*
export OS_AUTH_URL=https://auth.cloud.ovh.net/v2.0

# With the addition of Keystone we have standardized on the term **tenant**
# as the entity that owns the resources.
export OS_TENANT_ID=b06e21b45b47459ba1e6fb3d6947b16c1
export OS_TENANT_NAME="90798195835700801"

# In addition to the owning entity (tenant), openstack stores the entity
# performing the action as the **user**.
export OS_USERNAME="W5fDEhnGn7ms1"

# With Keystone you pass the keystone password.
echo "Please enter your OpenStack Password: "
read -sr OS_PASSWORD_INPUT
export OS_PASSWORD=$OS_PASSWORD_INPUT

# If your configuration has multiple regions, we set that information here.
# OS_REGION_NAME is optional and only valid in certain environments.
export OS_REGION_NAME="SBG1"
# Don't leave a blank variable, unset it if it was empty
if [ -z "$OS_REGION_NAME" ]; then unset OS_REGION_NAME; fi

Now, we will look to install the dependencies for OpenStack, we can run the following commands:

1) sudo apt-get install -y python-dev python-pip python-virtualenv
2) virtualenv venv
3) source venv/bin/activate

When you execute command #3, your command prompt will change, it will show the following value:

root@mysuperweb.co.uk:~# source venv/bin/activate
(venv)root@mysuperweb.co.uk:~# 

4) pip install python-novaclient python-keystoneclient python-swiftclient

5) sudo apt-get install python-glanceclient python-novaclient

To connect the OpenStack with the Public Cloud instance, we will run the following command:

(venv)root@mysuperweb.co.uk:~# source openrc.sh 

Please enter your OpenStack Password:     <--- The OpenStack password is the same one we used to login to the Horizon.

(venv)root@mysuperweb.co.uk:~# 

We have now connected to the OpenStack environment, we can run commands to see what is happening such as:

(venv)root@mysuperweb.co.uk:~# nova list
+--------------------+-------------------+--------+------------+-------------+---------------------+
| ID                 | Name              | Status | Task State | Power State | Networks            |
+--------------------+-------------------+--------+------------+-------------+---------------------+
| 2642baa5-a29e-4741 | mysuperweb.co.uk  | ACTIVE | -          | Running     | Ext-Net=192.168.0.1 |
+--------------------+-------------------+--------+------------+-------------+---------------------+