Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 69 lines (54 sloc) 3.446 kB
ed5d0f0 Initial checkin of this repository
Emilien Macchi authored
1 #!/bin/sh
2 #
3 # Keystone Datas
4 #
5 # Description: Fill Keystone with datas.
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 ADMIN_PASSWORD=${ADMIN_PASSWORD:-password}
16 SERVICE_PASSWORD=${SERVICE_PASSWORD:-$ADMIN_PASSWORD}
17 export SERVICE_TOKEN="password"
97ca2d5 Update scripts/keystone-data.sh
Emilien Macchi authored
18 export SERVICE_ENDPOINT="http://localhost:35357/v2.0"
ed5d0f0 Initial checkin of this repository
Emilien Macchi authored
19 SERVICE_TENANT_NAME=${SERVICE_TENANT_NAME:-service}
20
21 get_id () {
22 echo `$@ | awk '/ id / { print $4 }'`
23 }
24
25 # Tenants
26 ADMIN_TENANT=$(get_id keystone tenant-create --name=admin)
27 SERVICE_TENANT=$(get_id keystone tenant-create --name=$SERVICE_TENANT_NAME)
28 DEMO_TENANT=$(get_id keystone tenant-create --name=demo)
29 INVIS_TENANT=$(get_id keystone tenant-create --name=invisible_to_admin)
30
31 # Users
32 ADMIN_USER=$(get_id keystone user-create --name=admin --pass="$ADMIN_PASSWORD" --email=admin@domain.com)
33 DEMO_USER=$(get_id keystone user-create --name=demo --pass="$ADMIN_PASSWORD" --email=demo@domain.com)
34
35 # Roles
36 ADMIN_ROLE=$(get_id keystone role-create --name=admin)
37 KEYSTONEADMIN_ROLE=$(get_id keystone role-create --name=KeystoneAdmin)
38 KEYSTONESERVICE_ROLE=$(get_id keystone role-create --name=KeystoneServiceAdmin)
39
40 # Add Roles to Users in Tenants
41 keystone user-role-add --user-id $ADMIN_USER --role-id $ADMIN_ROLE --tenant-id $ADMIN_TENANT
42 keystone user-role-add --user-id $ADMIN_USER --role-id $ADMIN_ROLE --tenant-id $DEMO_TENANT
43 keystone user-role-add --user-id $ADMIN_USER --role-id $KEYSTONEADMIN_ROLE --tenant-id $ADMIN_TENANT
44 keystone user-role-add --user-id $ADMIN_USER --role-id $KEYSTONESERVICE_ROLE --tenant-id $ADMIN_TENANT
45
46 # The Member role is used by Horizon and Swift
47 MEMBER_ROLE=$(get_id keystone role-create --name=Member)
48 keystone user-role-add --user-id $DEMO_USER --role-id $MEMBER_ROLE --tenant-id $DEMO_TENANT
49 keystone user-role-add --user-id $DEMO_USER --role-id $MEMBER_ROLE --tenant-id $INVIS_TENANT
50
51 # Configure service users/roles
52 NOVA_USER=$(get_id keystone user-create --name=nova --pass="$SERVICE_PASSWORD" --tenant-id $SERVICE_TENANT --email=nova@domain.com)
53 keystone user-role-add --tenant-id $SERVICE_TENANT --user-id $NOVA_USER --role-id $ADMIN_ROLE
54
55 GLANCE_USER=$(get_id keystone user-create --name=glance --pass="$SERVICE_PASSWORD" --tenant-id $SERVICE_TENANT --email=glance@domain.com)
56 keystone user-role-add --tenant-id $SERVICE_TENANT --user-id $GLANCE_USER --role-id $ADMIN_ROLE
57
58 SWIFT_USER=$(get_id keystone user-create --name=swift --pass="$SERVICE_PASSWORD" --tenant-id $SERVICE_TENANT --email=swift@domain.com)
59 keystone user-role-add --tenant-id $SERVICE_TENANT --user-id $SWIFT_USER --role-id $ADMIN_ROLE
60
61 RESELLER_ROLE=$(get_id keystone role-create --name=ResellerAdmin)
62 keystone user-role-add --tenant-id $SERVICE_TENANT --user-id $NOVA_USER --role-id $RESELLER_ROLE
63
64 QUANTUM_USER=$(get_id keystone user-create --name=quantum --pass="$SERVICE_PASSWORD" --tenant-id $SERVICE_TENANT --email=quantum@domain.com)
65 keystone user-role-add --tenant-id $SERVICE_TENANT --user-id $QUANTUM_USER --role-id $ADMIN_ROLE
66
67 CINDER_USER=$(get_id keystone user-create --name=cinder --pass="$SERVICE_PASSWORD" --tenant-id $SERVICE_TENANT --email=cinder@domain.com)
68 keystone user-role-add --tenant-id $SERVICE_TENANT --user-id $CINDER_USER --role-id $ADMIN_ROLE
Something went wrong with that request. Please try again.