Anthony Young | 6ab10d4 | 2011-10-20 10:24:50 -0700 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Dean Troyer | 4807df8 | 2012-02-24 10:44:18 -0600 | [diff] [blame] | 2 | # |
| 3 | # source openrc [username] [tenantname] |
| 4 | # |
| 5 | # Configure a set of credentials for $TENANT/$USERNAME: |
Russell Bryant | 08e07fb | 2012-03-28 15:23:58 -0400 | [diff] [blame^] | 6 | # Set OS_TENANT_NAME to override the default tenant 'demo' |
| 7 | # Set OS_USERNAME to override the default user name 'demo' |
Dean Troyer | 4807df8 | 2012-02-24 10:44:18 -0600 | [diff] [blame] | 8 | # 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 | |
| 13 | if [[ -n "$1" ]]; then |
Russell Bryant | 08e07fb | 2012-03-28 15:23:58 -0400 | [diff] [blame^] | 14 | OS_USERNAME=$1 |
Dean Troyer | 4807df8 | 2012-02-24 10:44:18 -0600 | [diff] [blame] | 15 | fi |
| 16 | if [[ -n "$2" ]]; then |
Russell Bryant | 08e07fb | 2012-03-28 15:23:58 -0400 | [diff] [blame^] | 17 | OS_TENANT_NAME=$2 |
Dean Troyer | 4807df8 | 2012-02-24 10:44:18 -0600 | [diff] [blame] | 18 | fi |
Anthony Young | 6ab10d4 | 2011-10-20 10:24:50 -0700 | [diff] [blame] | 19 | |
Dean Troyer | 0bd2410 | 2012-03-08 00:33:54 -0600 | [diff] [blame] | 20 | # Find the other rc files |
| 21 | RC_DIR=$(cd $(dirname "$BASH_SOURCE") && pwd) |
| 22 | |
Anthony Young | 6ab10d4 | 2011-10-20 10:24:50 -0700 | [diff] [blame] | 23 | # Load local configuration |
Dean Troyer | 0bd2410 | 2012-03-08 00:33:54 -0600 | [diff] [blame] | 24 | source $RC_DIR/stackrc |
Anthony Young | 6ab10d4 | 2011-10-20 10:24:50 -0700 | [diff] [blame] | 25 | |
Dean Troyer | 4807df8 | 2012-02-24 10:44:18 -0600 | [diff] [blame] | 26 | # The introduction of Keystone to the OpenStack ecosystem has standardized the |
| 27 | # term **tenant** as the entity that owns resources. In some places references |
| 28 | # still exist to the original Nova term **project** for this use. Also, |
| 29 | # **tenant_name** is prefered to **tenant_id**. |
Russell Bryant | 08e07fb | 2012-03-28 15:23:58 -0400 | [diff] [blame^] | 30 | export OS_TENANT_NAME=${OS_TENANT_NAME:-demo} |
Dean Troyer | 4807df8 | 2012-02-24 10:44:18 -0600 | [diff] [blame] | 31 | |
| 32 | # In addition to the owning entity (tenant), nova stores the entity performing |
| 33 | # the action as the **user**. |
Russell Bryant | 08e07fb | 2012-03-28 15:23:58 -0400 | [diff] [blame^] | 34 | export OS_USERNAME=${OS_USERNAME:-demo} |
Dean Troyer | 4807df8 | 2012-02-24 10:44:18 -0600 | [diff] [blame] | 35 | |
| 36 | # With Keystone you pass the keystone password instead of an api key. |
| 37 | # Recent versions of novaclient use OS_PASSWORD instead of NOVA_API_KEYs |
| 38 | # or NOVA_PASSWORD. |
| 39 | export OS_PASSWORD=${ADMIN_PASSWORD:-secrete} |
| 40 | |
Anthony Young | 1097c7c | 2011-12-27 23:22:14 -0800 | [diff] [blame] | 41 | # Set api HOST_IP endpoint. SERVICE_HOST may also be used to specify the endpoint, |
| 42 | # which is convenient for some localrc configurations. |
Jesse Andrews | f75d848 | 2011-10-24 13:38:52 -0700 | [diff] [blame] | 43 | HOST_IP=${HOST_IP:-127.0.0.1} |
Anthony Young | 1097c7c | 2011-12-27 23:22:14 -0800 | [diff] [blame] | 44 | SERVICE_HOST=${SERVICE_HOST:-$HOST_IP} |
Anthony Young | 6ab10d4 | 2011-10-20 10:24:50 -0700 | [diff] [blame] | 45 | |
Adam Gandelman | ce05e03 | 2012-01-30 14:43:14 -0800 | [diff] [blame] | 46 | # Some exercises call glance directly. On a single-node installation, Glance |
| 47 | # should be listening on HOST_IP. If its running elsewhere, it can be set here |
| 48 | GLANCE_HOST=${GLANCE_HOST:-$HOST_IP} |
| 49 | |
Dean Troyer | 4807df8 | 2012-02-24 10:44:18 -0600 | [diff] [blame] | 50 | # Authenticating against an Openstack cloud using Keystone returns a **Token** |
| 51 | # and **Service Catalog**. The catalog contains the endpoints for all services |
| 52 | # the user/tenant has access to - including nova, glance, keystone, swift, ... |
| 53 | # We currently recommend using the 2.0 *identity api*. |
Anthony Young | 6ab10d4 | 2011-10-20 10:24:50 -0700 | [diff] [blame] | 54 | # |
Dean Troyer | 4807df8 | 2012-02-24 10:44:18 -0600 | [diff] [blame] | 55 | # *NOTE*: Using the 2.0 *identity api* does not mean that compute api is 2.0. We |
Jesse Andrews | 9c85373 | 2011-10-21 19:05:40 -0700 | [diff] [blame] | 56 | # will use the 1.1 *compute api* |
Dean Troyer | 4807df8 | 2012-02-24 10:44:18 -0600 | [diff] [blame] | 57 | export OS_AUTH_URL=http://$SERVICE_HOST:5000/v2.0 |
Anthony Young | 6ab10d4 | 2011-10-20 10:24:50 -0700 | [diff] [blame] | 58 | |
| 59 | # Currently novaclient needs you to specify the *compute api* version. This |
| 60 | # needs to match the config of your catalog returned by Keystone. |
Anthony Young | d81ed03 | 2011-10-20 13:09:39 -0700 | [diff] [blame] | 61 | export NOVA_VERSION=${NOVA_VERSION:-1.1} |
Dean Troyer | 4807df8 | 2012-02-24 10:44:18 -0600 | [diff] [blame] | 62 | # In the future this will change names: |
| 63 | export COMPUTE_API_VERSION=${COMPUTE_API_VERSION:-$NOVA_VERSION} |
Anthony Young | 6ab10d4 | 2011-10-20 10:24:50 -0700 | [diff] [blame] | 64 | |
| 65 | # set log level to DEBUG (helps debug issues) |
Dean Troyer | 0bd2410 | 2012-03-08 00:33:54 -0600 | [diff] [blame] | 66 | # export KEYSTONECLIENT_DEBUG=1 |
Jesse Andrews | f1bfba2 | 2011-10-24 10:56:10 -0700 | [diff] [blame] | 67 | # export NOVACLIENT_DEBUG=1 |