Knowledgebase
Install openstack-python client and authenticate with an API user
Posted by Tobias J on 2018-06-13 09:45

First of all make sure you have python 2.7 or later installed. Install pip on the machine.

MacOS

# easy_install pip

Microsoft

C:\>easy_install pip

Ubuntu or Debian

# apt install python-dev python-pip

Red Hat Enterprice Linux, CentOS or Fedora

# yum install python-devel python-pip

After pip is installed we can install the python-openstack client by running the following command.

# pip install python-openstackclient

If you don`t want to install it via pip it is possible to install it from packages. RDO, Debian, and Ubuntu have client packages that can be installed without pip. 

Red Hat Enterprice Linux, CentOS or Fedora

# yum install python-openstackclient

Ubuntu or Debian

# apt-get install python-openstackclient

 

When we have a client installed we need to create an API user. To do this login to https://citycontrolpanel.com and click on API and then on "Native Openstack API"

Here you will se current users and you can see all endpoints where to connect for different clients. We will focus on the openstack client and wont bother with anything else for now. 

To create a new user click on the "+Add new user" button. Fill in the username and password for your user and drag the project you want that user to have access to into the correct box. Several projects can be chosen. Then Click on "Save".

To be able to use the openstack client we have to authenticate with our new API user. To do this we first have to download an RC file. To do this click on the gear icon next to your API user and then on "Download RC-File"

Download the file. We then have to change the password in this file before doing anything else.

When this is done we have to make sure our client program can find the OS_ variables. To do this we need to source the file. Simply run "source openstack.rc" in a terminal and after that you are good to go. Try running an openstack command.