OpenStackClient (aka OSC) is a command-line client for OpenStack that brings the command set for Compute, Identity, Image, Object Storage and Block Storage APIs together in a single shell with a uniform command structure.
Before installing the OpenStack Client on Windows you will need to have the Windows Subsystem for Linux installed and an Linux distribution from the Microsoft store
Installing WSL takes about 5 minutes and is documented here
In this example we will be installing the OpenStack client with the Python package manager pip
pip is available for Python3 as pip3 and Python2 as simply pip. We will install pip for Python2
sudo apt update
Install pip and Python dev tools
sudo apt install python-dev python-pip
Verify the pip Version
pip --version
Install the OpenStack Client using pip
sudo pip install python-openstackclient
Install specific Openstack project packages
sudo pip install python-magnumclient
Setup Bash completion for OpenStack commands, bash completion will allow you to tab thru Openstack commands, this is very useful when learning about the client
openstack complete | sudo tee /etc/bash_completion.d/osc.bash_completion > /dev/null
log out and back in to the shell or source the osc.bash_completion
file
source /etc/bash_completion.d/osc.bash_completion
After installing the client we can now need to authenticate to OpenStack, The client will read our environment variables to find out how to connect to, and authenticate with, OpenStack. We will create a file which sets these variables, they are usually refereed to as RC files for 'run command'
We can normally get these files from the OpenStack dashboard, but the default details provided by the dashboard are hard coded and ultimately wrong for our purposes. I have filed a bug regarding this
Using a text editor create a file with the following contents, when we 'source' this file it will load environment variables into our current session, these variables configure the OpenStack client
export OS_AUTH_URL="https://openstack.cloudenci.ie:5000/v3" export OS_REGION_NAME="RegionOne" export OS_USERNAME="" export OS_PASSWORD="" export OS_TENANT_NAME="" export OS_PROJECT_DOMAIN_ID=${OS_PROJECT_DOMAIN_ID:-"0d6c7d1a8861431d84b18ee55649c69c"} export OS_IDENTITY_API_VERSION=3 export OS_IDENTITY_PROVIDER=${OS_IDENTITY_PROVIDER:-"ncirl_idp"} export OS_PROTOCOL=saml2 export OS_AUTH_TYPE=v3samlpassword export OS_IDENTITY_PROVIDER_URL="https://idp.ncirl.ie/idp/profile/SAML2/SOAP/ECP"
Copy and paste the above into a file called openrc
filling in the username, password and tenant name (e.g. MSC-SOMETHING)
With the client installed and the RC file created we can now source the file to load the environment variables
source openrc
Confirm by printing the environemt variables and looking for variables that begin with 'OS'
printenv | grep OS
now try these commands
List Servers
openstack server list
List key pairs
openstack keypair list
List avaialble images
openstack image list
We can also create, remove, update and delete resources with the CLI