Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 149 lines (133 sloc) 5.239 kB
ed5d0f0 Initial checkin of this repository
Emilien Macchi authored
1 #!/bin/sh
2 #
3 # Keystone Endpoints
4 #
5 # Description: Create Services Endpoints
6
7 # Mainly inspired by http://www.hastexo.com/resources/docs/installing-openstack-essex-20121-ubuntu-1204-precise-pangolin
8 # Written by Martin Gerhard Loschwitz / Hastexo
9 # Modified by Emilien Macchi / StackOps
10 #
11 # Support: openstack@lists.launchpad.net
12 # License: Apache Software License (ASL) 2.0
13 #
14
15
16 # MySQL definitions
17 MYSQL_USER=keystone
18 MYSQL_DATABASE=keystone
19 MYSQL_HOST=localhost
20 MYSQL_PASSWORD=password
21
22 # Keystone definitions
23 KEYSTONE_REGION=RegionOne
24 SERVICE_TOKEN=password
25 SERVICE_ENDPOINT="http://localhost:35357/v2.0"
26
27 # other definitions
6c47b69 Update
root authored
28 MASTER="192.168.0.1"
ed5d0f0 Initial checkin of this repository
Emilien Macchi authored
29
30 while getopts "u:D:p:m:K:R:E:S:T:vh" opt; do
31 case $opt in
32 u)
33 MYSQL_USER=$OPTARG
34 ;;
35 D)
36 MYSQL_DATABASE=$OPTARG
37 ;;
38 p)
39 MYSQL_PASSWORD=$OPTARG
40 ;;
41 m)
42 MYSQL_HOST=$OPTARG
43 ;;
44 K)
45 MASTER=$OPTARG
46 ;;
47 R)
48 KEYSTONE_REGION=$OPTARG
49 ;;
50 E)
51 export SERVICE_ENDPOINT=$OPTARG
52 ;;
53 S)
54 SWIFT_MASTER=$OPTARG
55 ;;
56 T)
57 export SERVICE_TOKEN=$OPTARG
58 ;;
59 v)
60 set -x
61 ;;
62 h)
63 cat <<EOF
64 Usage: $0 [-m mysql_hostname] [-u mysql_username] [-D mysql_database] [-p mysql_password]
65 [-K keystone_master ] [ -R keystone_region ] [ -E keystone_endpoint_url ]
66 [ -S swift_master ] [ -T keystone_token ]
67
68 Add -v for verbose mode, -h to display this message.
69 EOF
70 exit 0
71 ;;
72 \?)
73 echo "Unknown option -$OPTARG" >&2
74 exit 1
75 ;;
76 :)
77 echo "Option -$OPTARG requires an argument" >&2
78 exit 1
79 ;;
80 esac
81 done
82
83 if [ -z "$KEYSTONE_REGION" ]; then
84 echo "Keystone region not set. Please set with -R option or set KEYSTONE_REGION variable." >&2
85 missing_args="true"
86 fi
87
88 if [ -z "$SERVICE_TOKEN" ]; then
89 echo "Keystone service token not set. Please set with -T option or set SERVICE_TOKEN variable." >&2
90 missing_args="true"
91 fi
92
93 if [ -z "$SERVICE_ENDPOINT" ]; then
94 echo "Keystone service endpoint not set. Please set with -E option or set SERVICE_ENDPOINT variable." >&2
95 missing_args="true"
96 fi
97
98 if [ -z "$MYSQL_PASSWORD" ]; then
99 echo "MySQL password not set. Please set with -p option or set MYSQL_PASSWORD variable." >&2
100 missing_args="true"
101 fi
102
103 if [ -n "$missing_args" ]; then
104 exit 1
105 fi
106
107 keystone service-create --name nova --type compute --description 'OpenStack Compute Service'
100f117 Update scripts/keystone-endpoints.sh
Emilien Macchi authored
108 keystone service-create --name cinder --type volume --description 'OpenStack Volume Service'
ed5d0f0 Initial checkin of this repository
Emilien Macchi authored
109 keystone service-create --name glance --type image --description 'OpenStack Image Service'
110 keystone service-create --name swift --type object-store --description 'OpenStack Storage Service'
111 keystone service-create --name keystone --type identity --description 'OpenStack Identity'
112 keystone service-create --name ec2 --type ec2 --description 'OpenStack EC2 service'
113 keystone service-create --name quantum --type network --description 'OpenStack Networking service'
114
115 create_endpoint () {
116 case $1 in
117 compute)
8121ee3 Update scripts/keystone-endpoints.sh
Emilien Macchi authored
118 keystone endpoint-create --region $KEYSTONE_REGION --service-id $2 --publicurl 'http://'"$MASTER"':8774/v2/$(tenant_id)s' --adminurl 'http://'"$MASTER"':8774/v2/$(tenant_id)s' --internalurl 'http://'"$MASTER"':8774/v2/$(tenant_id)s'
ed5d0f0 Initial checkin of this repository
Emilien Macchi authored
119 ;;
120 volume)
8121ee3 Update scripts/keystone-endpoints.sh
Emilien Macchi authored
121 keystone endpoint-create --region $KEYSTONE_REGION --service-id $2 --publicurl 'http://'"$MASTER"':8776/v1/$(tenant_id)s' --adminurl 'http://'"$MASTER"':8776/v1/$(tenant_id)s' --internalurl 'http://'"$MASTER"':8776/v1/$(tenant_id)s'
ed5d0f0 Initial checkin of this repository
Emilien Macchi authored
122 ;;
123 image)
124 keystone endpoint-create --region $KEYSTONE_REGION --service-id $2 --publicurl 'http://'"$MASTER"':9292/v2' --adminurl 'http://'"$MASTER"':9292/v2' --internalurl 'http://'"$MASTER"':9292/v2'
125 ;;
126 object-store)
127 if [ $SWIFT_MASTER ]; then
8121ee3 Update scripts/keystone-endpoints.sh
Emilien Macchi authored
128 keystone endpoint-create --region $KEYSTONE_REGION --service-id $2 --publicurl 'http://'"$SWIFT_MASTER"':8080/v1/AUTH_$(tenant_id)s' --adminurl 'http://'"$SWIFT_MASTER"':8080/v1' --internalurl 'http://'"$SWIFT_MASTER"':8080/v1/AUTH_$(tenant_id)s'
ed5d0f0 Initial checkin of this repository
Emilien Macchi authored
129 else
8121ee3 Update scripts/keystone-endpoints.sh
Emilien Macchi authored
130 keystone endpoint-create --region $KEYSTONE_REGION --service-id $2 --publicurl 'http://'"$MASTER"':8080/v1/AUTH_$(tenant_id)s' --adminurl 'http://'"$MASTER"':8080/v1' --internalurl 'http://'"$MASTER"':8080/v1/AUTH_$(tenant_id)s'
ed5d0f0 Initial checkin of this repository
Emilien Macchi authored
131 fi
132 ;;
133 identity)
134 keystone endpoint-create --region $KEYSTONE_REGION --service-id $2 --publicurl 'http://'"$MASTER"':5000/v2.0' --adminurl 'http://'"$MASTER"':35357/v2.0' --internalurl 'http://'"$MASTER"':5000/v2.0'
135 ;;
136 ec2)
137 keystone endpoint-create --region $KEYSTONE_REGION --service-id $2 --publicurl 'http://'"$MASTER"':8773/services/Cloud' --adminurl 'http://'"$MASTER"':8773/services/Admin' --internalurl 'http://'"$MASTER"':8773/services/Cloud'
138 ;;
139 network)
8121ee3 Update scripts/keystone-endpoints.sh
Emilien Macchi authored
140 keystone endpoint-create --region $KEYSTONE_REGION --service-id $2 --publicurl 'http://'"$MASTER"':9696/' --adminurl 'http://'"$MASTER"':9696/' --internalurl 'http://'"$MASTER"':9696/'
ed5d0f0 Initial checkin of this repository
Emilien Macchi authored
141 ;;
142 esac
143 }
144
145 for i in compute volume image object-store identity ec2 network; do
146 id=`mysql -h "$MYSQL_HOST" -u "$MYSQL_USER" -p"$MYSQL_PASSWORD" "$MYSQL_DATABASE" -ss -e "SELECT id FROM service WHERE type='"$i"';"` || exit 1
147 create_endpoint $i $id
6c47b69 Update
root authored
148 done
Something went wrong with that request. Please try again.