c75a6f6784
Reverting back to use keystone v2 based openstackclient command because folks are getting confused about the command differences. The previous 'fix' doesn't work if without additional options. Change-Id: I8a3cc69079d969f3ac13d80c0b02ee89bede071d
60 lines
1.3 KiB
Bash
Executable File
60 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
if [[ -z $OS_AUTH_URL ]]; then
|
|
echo "This script must have proper environment variables exported."
|
|
echo "Please check if you have sourced senlinrc file or openrc file if "
|
|
echo "you are using devstack."
|
|
exit -1
|
|
fi
|
|
|
|
if [ $OS_USERNAME != 'admin' ]; then
|
|
echo "This script has to be executed as an 'admin' user."
|
|
echo "Please set environment variable OS_USERNAME to 'admin'."
|
|
exit -1
|
|
fi
|
|
|
|
if [ $# -ne 2 ]; then
|
|
echo "Usage: `basename $0` <HOST_IP> <SERVICE_PASSWORD>"
|
|
exit -1
|
|
fi
|
|
|
|
PORT=8778
|
|
HOST=$1 # Put your host IP here
|
|
SVC_PASSWD=$2
|
|
|
|
SERVICE_ID=$(openstack service show senlin -f value -cid 2>/dev/null)
|
|
if [[ -z $SERVICE_ID ]]; then
|
|
SERVICE_ID=$(openstack service create \
|
|
--name senlin \
|
|
--description 'Senlin Clustering Service V1' \
|
|
-f value -cid \
|
|
clustering)
|
|
fi
|
|
|
|
if [[ -z $SERVICE_ID ]]; then
|
|
exit
|
|
fi
|
|
|
|
openstack endpoint create \
|
|
--adminurl "http://$HOST:$PORT" \
|
|
--publicurl "http://$HOST:$PORT" \
|
|
--internalurl "http://$HOST:$PORT" \
|
|
--region RegionOne \
|
|
senlin
|
|
|
|
openstack user create \
|
|
--password "$SVC_PASSWD" \
|
|
--project service \
|
|
senlin
|
|
|
|
openstack role add \
|
|
admin \
|
|
--user senlin \
|
|
--project service
|
|
|
|
# make sure 'senlin' has 'service' role in 'demo' project
|
|
openstack role add \
|
|
service \
|
|
--user senlin \
|
|
--project demo
|