blob: 64faa58a3a9b8bc4a5f4e525b1c806f7c2c3bf5d [file] [log] [blame]
Anthony Young6ab10d42011-10-20 10:24:50 -07001#!/usr/bin/env bash
Dean Troyer4807df82012-02-24 10:44:18 -06002#
3# source openrc [username] [tenantname]
4#
5# Configure a set of credentials for $TENANT/$USERNAME:
Russell Bryant08e07fb2012-03-28 15:23:58 -04006# Set OS_TENANT_NAME to override the default tenant 'demo'
7# Set OS_USERNAME to override the default user name 'demo'
Dean Troyer4807df82012-02-24 10:44:18 -06008# Set ADMIN_PASSWORD to set the password for 'admin' and 'demo'
9
10# NOTE: support for the old NOVA_* novaclient environment variables has
11# been removed.
12
13if [[ -n "$1" ]]; then
Russell Bryant08e07fb2012-03-28 15:23:58 -040014 OS_USERNAME=$1
Dean Troyer4807df82012-02-24 10:44:18 -060015fi
16if [[ -n "$2" ]]; then
Russell Bryant08e07fb2012-03-28 15:23:58 -040017 OS_TENANT_NAME=$2
Dean Troyer4807df82012-02-24 10:44:18 -060018fi
Anthony Young6ab10d42011-10-20 10:24:50 -070019
Dean Troyer0bd24102012-03-08 00:33:54 -060020# Find the other rc files
Peter Feiner388e36c2013-10-24 18:51:44 -040021RC_DIR=$(cd $(dirname "${BASH_SOURCE:-$0}") && pwd)
Dean Troyer0bd24102012-03-08 00:33:54 -060022
Jeff Peelerebdd61d2013-06-01 00:54:47 -040023# Import common functions
24source $RC_DIR/functions
25
Anthony Young6ab10d42011-10-20 10:24:50 -070026# Load local configuration
Dean Troyer0bd24102012-03-08 00:33:54 -060027source $RC_DIR/stackrc
Anthony Young6ab10d42011-10-20 10:24:50 -070028
Dean Troyer33cb4302012-12-10 16:47:36 -060029# Load the last env variables if available
Dean Troyer3ac95352013-03-29 10:15:36 -050030if [[ -r $RC_DIR/.stackenv ]]; then
31 source $RC_DIR/.stackenv
Dean Troyer33cb4302012-12-10 16:47:36 -060032fi
33
Dean Troyerc83a7e12012-11-29 11:47:58 -060034# Get some necessary configuration
35source $RC_DIR/lib/tls
36
Dean Troyer4807df82012-02-24 10:44:18 -060037# The introduction of Keystone to the OpenStack ecosystem has standardized the
38# term **tenant** as the entity that owns resources. In some places references
39# still exist to the original Nova term **project** for this use. Also,
Joe Gordon46400262013-06-30 04:32:27 -070040# **tenant_name** is preferred to **tenant_id**.
Russell Bryant08e07fb2012-03-28 15:23:58 -040041export OS_TENANT_NAME=${OS_TENANT_NAME:-demo}
Dean Troyer4807df82012-02-24 10:44:18 -060042
43# In addition to the owning entity (tenant), nova stores the entity performing
44# the action as the **user**.
Russell Bryant08e07fb2012-03-28 15:23:58 -040045export OS_USERNAME=${OS_USERNAME:-demo}
Dean Troyer4807df82012-02-24 10:44:18 -060046
47# With Keystone you pass the keystone password instead of an api key.
48# Recent versions of novaclient use OS_PASSWORD instead of NOVA_API_KEYs
49# or NOVA_PASSWORD.
50export OS_PASSWORD=${ADMIN_PASSWORD:-secrete}
51
Vishvananda Ishaya7b0f0022012-08-10 22:31:19 +000052# Don't put the key into a keyring by default. Testing for development is much
53# easier with this off.
54export OS_NO_CACHE=${OS_NO_CACHE:-1}
55
Bartosz Górski0abde392014-02-28 14:15:19 +010056# Region
57export OS_REGION_NAME=${REGION_NAME:-RegionOne}
58
Anthony Young1097c7c2011-12-27 23:22:14 -080059# Set api HOST_IP endpoint. SERVICE_HOST may also be used to specify the endpoint,
60# which is convenient for some localrc configurations.
Jesse Andrewsf75d8482011-10-24 13:38:52 -070061HOST_IP=${HOST_IP:-127.0.0.1}
Anthony Young1097c7c2011-12-27 23:22:14 -080062SERVICE_HOST=${SERVICE_HOST:-$HOST_IP}
Dean Troyerc83a7e12012-11-29 11:47:58 -060063SERVICE_PROTOCOL=${SERVICE_PROTOCOL:-http}
Jamie Lennoxbd24a8d2013-09-20 16:26:42 +100064KEYSTONE_AUTH_PROTOCOL=${KEYSTONE_AUTH_PROTOCOL:-$SERVICE_PROTOCOL}
Bartosz Górski0abde392014-02-28 14:15:19 +010065KEYSTONE_AUTH_HOST=${KEYSTONE_AUTH_HOST:-$SERVICE_HOST}
Anthony Young6ab10d42011-10-20 10:24:50 -070066
Adam Gandelmance05e032012-01-30 14:43:14 -080067# Some exercises call glance directly. On a single-node installation, Glance
68# should be listening on HOST_IP. If its running elsewhere, it can be set here
69GLANCE_HOST=${GLANCE_HOST:-$HOST_IP}
70
Yong Sheng Gong300e1bf2013-08-28 17:02:56 +080071# Identity API version
72export OS_IDENTITY_API_VERSION=${IDENTITY_API_VERSION:-2.0}
73
tanlin2b69f232014-02-12 16:11:32 +080074# Authenticating against an OpenStack cloud using Keystone returns a **Token**
Dean Troyer4807df82012-02-24 10:44:18 -060075# and **Service Catalog**. The catalog contains the endpoints for all services
76# the user/tenant has access to - including nova, glance, keystone, swift, ...
77# We currently recommend using the 2.0 *identity api*.
Anthony Young6ab10d42011-10-20 10:24:50 -070078#
Bartosz Górski0abde392014-02-28 14:15:19 +010079export OS_AUTH_URL=$KEYSTONE_AUTH_PROTOCOL://$KEYSTONE_AUTH_HOST:5000/v${OS_IDENTITY_API_VERSION}
Dean Troyerc83a7e12012-11-29 11:47:58 -060080
Clint Byrum52a3beb2015-05-05 15:00:03 -070081# Set OS_CACERT to a default CA certificate chain if it exists.
82if [[ ! -v OS_CACERT ]] ; then
83 DEFAULT_OS_CACERT=$INT_CA_DIR/ca-chain.pem
84 # If the file does not exist, this may confuse preflight sanity checks
85 if [ -e $DEFAULT_OS_CACERT ] ; then
86 export OS_CACERT=$DEFAULT_OS_CACERT
87 fi
88fi
Anthony Young6ab10d42011-10-20 10:24:50 -070089
90# Currently novaclient needs you to specify the *compute api* version. This
91# needs to match the config of your catalog returned by Keystone.
Anthony Youngd81ed032011-10-20 13:09:39 -070092export NOVA_VERSION=${NOVA_VERSION:-1.1}
Dean Troyer4807df82012-02-24 10:44:18 -060093# In the future this will change names:
94export COMPUTE_API_VERSION=${COMPUTE_API_VERSION:-$NOVA_VERSION}
Mike Perezbd8ac012013-08-20 21:53:30 -070095
96# Currently cinderclient needs you to specify the *volume api* version. This
97# needs to match the config of your catalog returned by Keystone.
98export CINDER_VERSION=${CINDER_VERSION:-2}
99export OS_VOLUME_API_VERSION=${OS_VOLUME_API_VERSION:-$CINDER_VERSION}