labs: add regular user and tenant (demo)
This changeset creates a regular user and a tenant, both named demo. A new demo-openstackrc.sh is added for authentication as this user. Change-Id: I386c38ff4accc8004cc5fb84f3936565f5694683 Co-Authored-By: Pranav Salunke <dguitarbite@gmail.com> Implements: blueprint openstack-training-labs
This commit is contained in:
parent
45c194845f
commit
0685a1c4a5
@ -26,6 +26,11 @@
|
||||
: ${ADMIN_USER_NAME:=admin}
|
||||
: ${ADMIN_PASSWORD:=admin_pass}
|
||||
|
||||
# Tenant name, user name and password for normal (demo) user
|
||||
: ${DEMO_TENANT_NAME:=demo}
|
||||
: ${DEMO_USER_NAME:=demo}
|
||||
: ${DEMO_PASSWORD:=demo_pass}
|
||||
|
||||
# OpenStack Services needs to be affiliated with a tenant to provide
|
||||
# authentication to other OpenStack services. We create a "service" tenant for
|
||||
# the OpenStack services. All the OpenStack services will be registered via
|
||||
|
15
labs/config/demo-openstackrc.sh
Normal file
15
labs/config/demo-openstackrc.sh
Normal file
@ -0,0 +1,15 @@
|
||||
# The variables in this file are exported for use by OpenStack client
|
||||
# applications.
|
||||
|
||||
# Unlike a regular openstackrc.sh file, this file gets its variable values
|
||||
# from other configuration files (to limit redundancy).
|
||||
|
||||
# Use BASH_SOURCE so the file works when sourced from a shell, too
|
||||
CONFIG_DIR=$(dirname "$BASH_SOURCE")
|
||||
source "$CONFIG_DIR/openstack"
|
||||
source "$CONFIG_DIR/credentials"
|
||||
|
||||
export OS_USERNAME=$DEMO_USER_NAME
|
||||
export OS_PASSWORD=$DEMO_PASSWORD
|
||||
export OS_TENANT_NAME=$DEMO_TENANT_NAME
|
||||
export OS_AUTH_URL="http://controller-mgmt:5000/v2.0"
|
@ -9,6 +9,7 @@ scripts setup_cinder_controller.sh
|
||||
scripts setup_cinder_volumes.sh
|
||||
scripts setup_horizon.sh
|
||||
scripts config_external_network.sh
|
||||
scripts config_demo_user.sh
|
||||
scripts shutdown.sh
|
||||
boot
|
||||
wait_for_shutdown
|
||||
|
28
labs/scripts/config_demo_user.sh
Executable file
28
labs/scripts/config_demo_user.sh
Executable file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
TOP_DIR=$(cd $(dirname "$0")/.. && pwd)
|
||||
source "$TOP_DIR/config/paths"
|
||||
source "$CONFIG_DIR/credentials"
|
||||
source "$LIB_DIR/functions.guest"
|
||||
source "$CONFIG_DIR/admin-openstackrc.sh"
|
||||
exec_logfile
|
||||
|
||||
indicate_current_auto
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Create a normal user
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
echo "Creating the demo user."
|
||||
keystone user-create \
|
||||
--name="$DEMO_USER_NAME" \
|
||||
--pass="$DEMO_PASSWORD" \
|
||||
--email=demo@example.com
|
||||
|
||||
echo "Creating the demo tenant."
|
||||
keystone tenant-create --name="$DEMO_TENANT_NAME" --description="Demo Tenant"
|
||||
|
||||
echo "Linking the demo user, _member_ role, and demo tenant."
|
||||
keystone user-role-add \
|
||||
--user "$DEMO_USER_NAME" \
|
||||
--role _member_ \
|
||||
--tenant "$DEMO_TENANT_NAME"
|
Loading…
x
Reference in New Issue
Block a user