Browse Source

Script for adding openstack users

Change-Id: I852875a2b596dbd05e0d555e6f6ae17c6d15e1eb
Kaspars Skels 3 months ago
parent
commit
d0833fb4d6
1 changed files with 41 additions and 0 deletions
  1. 41
    0
      tools/openstack-user-add

+ 41
- 0
tools/openstack-user-add View File

@@ -0,0 +1,41 @@
1
+#!/bin/bash
2
+
3
+if [ -z "$2" ]; then
4
+    echo "Usage: openstack-user-add <user> <email>"
5
+    exit 1
6
+fi
7
+
8
+
9
+OS_USER=$1
10
+OS_PROJ="${OS_USER}-proj"
11
+OS_EMAIL=$2
12
+
13
+OS_PASSWD=`openssl rand -hex 10`
14
+OS_DOMAIN='default'
15
+
16
+openstack domain create --or-show --enable ${OS_DOMAIN}
17
+
18
+openstack project create --or-show --enable \
19
+    --domain ${OS_DOMAIN} ${OS_PROJ}
20
+
21
+openstack user create --or-show --enable \
22
+    --domain ${OS_DOMAIN} \
23
+    --email ${OS_EMAIL} ${OS_USER}
24
+
25
+openstack user set --domain ${OS_DOMAIN} \
26
+    --password=${OS_PASSWD} ${OS_USER}
27
+
28
+openstack role add --project-domain ${OS_DOMAIN} \
29
+    --user-domain ${OS_DOMAIN} \
30
+    --project ${OS_PROJ} \
31
+    --user ${OS_USER} member
32
+
33
+openstack quota set --floating-ips 4 ${OS_PROJ}
34
+openstack quota set --cores 36 ${OS_PROJ}
35
+openstack quota set --ram 98304 ${OS_PROJ}
36
+
37
+echo https://dashboard.atlantafoundry.com/
38
+echo "Domain: ${OS_DOMAIN}"
39
+echo "User: ${OS_USER}"
40
+echo "Passwd: ${OS_PASSWD}"
41
+

Loading…
Cancel
Save