-
Notifications
You must be signed in to change notification settings - Fork 2
/
init.sh
61 lines (58 loc) · 1.94 KB
/
init.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env bash
keystone_ep="http://localhost:8000/v3/"
init_ep="http://localhost:8001/v3"
curl -i -X POST --url $init_ep
token=$(curl -i -H "Content-Type: application/json" -X POST --url $keystone_ep'auth/tokens' -d '{
"auth" : {
"identity" : {
"methods" : [ "password" ],
"password" : {
"user" : {
"name" : "'"$1"'",
"domain" : {
"name" : "Default"
},
"password" : "'"$2"'"
}
}
}
}
}' | grep X-Subject-Token| awk {'print $2'})
curl -H "Content-Type: application/json" -H "X-Auth-Token: "$token -X POST --url $keystone_ep'regions' -d '{
"region": {
"description": "My subregion",
"id": "RegionOne"
}
}'
identity_service_id=$(curl -H "Content-Type: application/json" -H "X-Auth-Token: "$token -X POST --url $keystone_ep'services' -d '{
"service": {
"type": "identity",
"name": "keystone",
"description": "identity service",
"enabled": true
}
}' | jq -r '.service.id')
curl -H "Content-Type: application/json" -H "X-Auth-Token: "$token -X POST --url $keystone_ep'endpoints' -d '{
"endpoint": {
"interface": "internal",
"region_id": "RegionOne",
"url": "'$keystone_ep'",
"service_id": "'$identity_service_id'"
}
}'
curl -H "Content-Type: application/json" -H "X-Auth-Token: "$token -X POST --url $keystone_ep'endpoints' -d '{
"endpoint": {
"interface": "public",
"region_id": "RegionOne",
"url": "'$keystone_ep'",
"service_id": "'$identity_service_id'"
}
}'
curl -H "Content-Type: application/json" -H "X-Auth-Token: "$token -X POST --url $keystone_ep'endpoints' -d '{
"endpoint": {
"interface": "admin",
"region_id": "RegionOne",
"url": "'$keystone_ep'",
"service_id": "'$identity_service_id'"
}
}'