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 | |
# Set up the packages we need | |
apt-get update | |
apt-get install git vim -y | |
# Clone the repos we need | |
git clone https://github.com/openstack-dev/devstack.git /tmp/devstack | |
cat <<EOF > /tmp/devstack/localrc |
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
MYTOKEN=$(openstack token issue | awk '/ id / { print $4 }') | |
MYPROJECT=$(openstack token issue | awk '/ project_id / { print $4 }') | |
DEFAULT_NETWORK=$(openstack subnet list | awk '/ private-subnet / {print $2}') | |
# Create a loadbalancer: | |
LB_ID=$(curl -X POST -H Content-type:application/json -H "X-Auth-Token:$MYTOKEN" -d '{"name": "test_lb", "vip": {"subnet_id": "'$DEFAULT_NETWORK'"}, "project_id": "'$MYPROJECT'"}' http://localhost:9876/v1/loadbalancers | python -m json.tool | awk '/"id"/ { print $2 }' | cut -d '"' -f 2) | |
# Get loadbalancer (do this until pending create is no longer pending...): | |
curl -H "X-Auth-Token:$MYTOKEN" http://localhost:9876/v1/loadbalancers/${LB_ID} | python -m json.tool |