Openstack Client Access

Configure Openstack API client

To configure the Openstack client, go to the

API Access

page and click **View Credentials**.

This will provide the information needed for the scripts.

Shell Script

#!/usr/bin/env bash
## 1) change the variables in the following section to match your information
## 2) dot source this script to configure the openstack client
## 3) run ‘openstack token issue’ to verify it is working
#### VARIABLES ####
USERNAME=”username”
PROJECT_ID=”project_id”
PROJECT_NAME=”project_name”
AUTH_URL=https://coe-openstack.vapor.gatech.edu:13000/v3
###################
export OS_AUTH_URL=$AUTH_URL
# With the addition of Keystone we have standardized on the term **project**
# as the entity that owns the resources.
export OS_PROJECT_ID=$PROJECT_ID
export OS_PROJECT_NAME=$PROJECT_NAME
export OS_USER_DOMAIN_NAME=”AD”
if [ -z “$OS_USER_DOMAIN_NAME” ]; then unset OS_USER_DOMAIN_NAME; fi
## unset v2.0 items in case set
unset OS_TENANT_ID
unset OS_TENANT_NAME
## In addition to the owning entity (tenant), OpenStack stores the entity
## performing the action as the **user**.
export OS_USERNAME=$USERNAME
## With Keystone you pass the keystone password.
echo “Please enter your OpenStack Password for project $OS_PROJECT_NAME as user $OS_USERNAME: “
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=”regionOne”
## Don’t leave a blank variable, unset it if it was empty
if [ -z “$OS_REGION_NAME” ]; then unset OS_REGION_NAME; fi
export OS_INTERFACE=public
export OS_IDENTITY_API_VERSION=3
export OS_AUTH_TYPE=password
unset OS_TOKEN
export OS_TOKEN=`openstack token issue –os-username $OS_USERNAME –os-password $OS_PASSWORD –os-user-domain-name $OS_USER_DOMAIN_NAME -f value -c id`
export OS_AUTH_TYPE=token
unset OS_PASSWORD
unset OS_USERNAME
unset OS_USER_DOMAIN_NAME

 

PowerShell

## 1) change the variables in the following section to match your information
## 2) dot source this script to configure the openstack client
## 3) run ‘openstack token issue’ to verify it is working
#### VARIABLES ####
$ENV:OS_USERNAME = “username”
$ENV:OS_PROJECT_ID = ‘project_id’
$ENV:OS_PROJECT_NAME = “project_name”
$ENV:OS_AUTH_URL = ‘https://coe-openstack.vapor.gatech.edu:13000/v3’
###################
$ENV:OS_USER_DOMAIN_NAME = “AD”
$ENV:OS_REGION_NAME = “regionOne”
$ENV:OS_INTERFACE = “public”
$ENV:OS_IDENTITY_API_VERSION = 3
$password_input = Read-Host -Prompt “Please enter your OpenStack Password for project $ENV:OS_PROJECT_NAME as user $ENV:OS_USERNAME” -AsSecureString
$ENV:OS_PASSWORD = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($password_input))
$ENV:OS_AUTH_TYPE = “password”
Remove-Item “ENV:OS_TOKEN” -Force -ErrorAction SilentlyContinue
$ENV:OS_TOKEN = & openstack token issue –os-username $ENV:OS_USERNAME –os-password $ENV:OS_PASSWORD –os-user-domain-name $ENV:OS_USER_DOMAIN_NAME -f value -c id
$ENV:OS_AUTH_TYPE = “token”
## Remove variables
Remove-Item “ENV:OS_PASSWORD”
Remove-Item “ENV:OS_USERNAME”
Remove-Item “ENV:OS_USER_DOMAIN_NAME”