training-guides/labs/scripts/config_demo_user.sh
Roger Luethi 0685a1c4a5 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
2014-08-18 22:50:45 +02:00

29 lines
851 B
Bash
Executable File

#!/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"