Skip to content

Instantly share code, notes, and snippets.

@FruitieX
Created January 9, 2015 13:40
Show Gist options
  • Save FruitieX/b2b21e9cb44d6475de21 to your computer and use it in GitHub Desktop.
Save FruitieX/b2b21e9cb44d6475de21 to your computer and use it in GitHub Desktop.
#!/bin/bash
source admin-openrc.sh
# openstackusers.txt is a plaintext file of format:
# username1 password1
# username2 password2
# ...
IFS=$'\n'
for line in $(cat openstackusers.txt); do
user=$(echo $line | cut -d' ' -f1)
pass=$(echo $line | cut -d' ' -f2)
echo "Creating openstack user $user"
keystone user-create --name=$user --pass="$pass"
keystone tenant-create --name=$user --description=$user
keystone user-role-add --user=$user --role=_member_ --tenant=$user
nova quota-update --instances 3 --cores 3 --ram 1536 --floating-ips 1 \
$(keystone tenant-list | awk "/ $user / {print \$2}")
neutron quota-update --network 1 --subnet 1 --router 1 --floatingip 1 \
--tenant-id $(keystone tenant-list | awk "/ $user / {print \$2}")
cinder quota-update --volumes 0 --gigabytes 0 \
$(keystone tenant-list | awk "/ $user / {print \$2}")
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment