senlin/tools/setup-service

48 lines
990 B
Bash
Executable File

#!/bin/bash
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/v1/\$(tenant_id)s" \
--publicurl "http://$HOST:$PORT/v1/\$(tenant_id)s" \
--internalurl "http://$HOST:$PORT/v1/\$(tenant_id)s" \
--region RegionOne \
senlin
openstack user create \
--password "$SVC_PASSWD" \
--project service \
--domain "default" \
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