Created
April 9, 2018 15:21
-
-
Save derekso/710cbd93a28b11aec06941dcbb570329 to your computer and use it in GitHub Desktop.
Create multiple tenants, users and spaces in Cloud Foundry
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash -e | |
# This script will create 10 different organizations | |
# with 2 spaces within each org and 5 users in each org. | |
# Written by Derek So on 23 Mar 2018 | |
cf login -u admin | |
TEAMSIZE=10 | |
USERPERTEAM=5 | |
TEAMPREFIX=team | |
PASSPREFIX=changeme | |
for t in $(seq -f '%02g' 01 $TEAMSIZE) | |
do | |
cf create-org $TEAMPREFIX$t | |
cf create-space dev -o $TEAMPREFIX$t | |
cf create-space prod -o $TEAMPREFIX$t | |
for u in $(seq -f '%02g' 01 $USERPERTEAM) | |
do | |
cf create-user user$t$u $PASSPREFIX$t$u | |
cf set-org-role user$t$u $TEAMPREFIX$t OrgManager | |
cf set-space-role user$t$u $TEAMPREFIX$t dev SpaceManager | |
cf set-space-role user$t$u $TEAMPREFIX$t dev SpaceDeveloper | |
cf set-space-role user$t$u $TEAMPREFIX$t prod SpaceManager | |
cf set-space-role user$t$u $TEAMPREFIX$t prod SpaceDeveloper | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment