Last active
December 10, 2015 16:24
-
-
Save brainstorm/b86b46cba452efb9300e to your computer and use it in GitHub Desktop.
This file contains 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 | |
# To use an Openstack cloud you need to authenticate against keystone, which | |
# returns a **Token** and **Service Catalog**. The catalog contains the | |
# endpoint for all services the user/tenant has access to - including nova, | |
# glance, keystone, swift. | |
# | |
# *NOTE*: Using the 2.0 *auth api* does not mean that compute api is 2.0. We | |
# will use the 1.1 *compute api* | |
export OS_AUTH_URL=https://pouta.csc.fi:5001/v2.0 | |
# With the addition of Keystone we have standardized on the term **tenant** | |
# as the entity that owns the resources. | |
export OS_TENANT_ID=roman | |
export OS_TENANT_NAME="roman" | |
# In addition to the owning entity (tenant), openstack stores the entity | |
# performing the action as the **user**. | |
export OS_USERNAME="roman" | |
# With Keystone you pass the keystone password. | |
#echo "Please enter your OpenStack Password: " | |
#read -sr OS_PASSWORD_INPUT | |
#export OS_PASSWORD=$OS_PASSWORD_INPUT | |
centos7_image="c802fc74-cda9-48a6-8450-2f34ff86cd45" | |
centos66_image="3f989426-47f1-4074-927d-cdad4ebd9483" | |
ubuntu_1504="b5371df0-4e81-41be-be13-beeba28a9354" | |
# If your configuration has multiple regions, we set that information here. | |
# OS_REGION_NAME is optional and only valid in certain environments. | |
export OS_REGION_NAME="regionOne" | |
# Don't leave a blank variable, unset it if it was empty | |
if [ -z "$OS_REGION_NAME" ]; then unset OS_REGION_NAME; fi | |
export DOCKER_SWARM_ID="<YOURTOKEN!!!>" | |
## Create docker-machine hosts | |
# Docker swarm master and nodes | |
# Ubuntu 15.04 require the following fix right after instantiation: https://github.com/maclennann/docker/commit/0e7fb272d6ce8e2 | |
docker-machine create -d openstack --openstack-ssh-user cloud-user --openstack-image-id $ubuntu_1504 --openstack-net-name $OS_USERNAME --openstack-floatingip-pool public --openstack-sec-groups default --openstack-flavor-name tiny --swarm-master --swarm-discovery token://$DOCKER_SWARM_ID swarm-master | |
docker-machine create -d openstack --openstack-ssh-user cloud-user --openstack-image-id $ubuntu_1504 --openstack-net-name $OS_USERNAME --openstack-floatingip-pool public --openstack-sec-groups default --openstack-flavor-name small --swarm --swarm-discovery token://$DOCKER_SWARM_ID swarm-node-00 | |
docker-machine create -d openstack --openstack-ssh-user cloud-user --openstack-image-id $ubuntu_1504 --openstack-net-name $OS_USERNAME --openstack-floatingip-pool public --openstack-sec-groups default --openstack-flavor-name mini --swarm --swarm-discovery token://$DOCKER_SWARM_ID swarm-node-01 | |
docker-machine create -d openstack --openstack-ssh-user cloud-user --openstack-image-id $ubuntu_1504 --openstack-net-name $OS_USERNAME --openstack-floatingip-pool public --openstack-sec-groups default --openstack-flavor-name mini --swarm --swarm-discovery token://$DOCKER_SWARM_ID swarm-node-02 | |
docker-machine create -d openstack --openstack-ssh-user cloud-user --openstack-image-id $ubuntu_1504 --openstack-net-name $OS_USERNAME --openstack-floatingip-pool public --openstack-sec-groups default --openstack-flavor-name mini --swarm --swarm-discovery token://$DOCKER_SWARM_ID swarm-node-03 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment