Created
November 28, 2018 09:10
-
-
Save liusheng/543d378022f12e1567ea5ee26090bd67 to your computer and use it in GitHub Desktop.
prepare net, subnet, vpc for oepnlab jobs running
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 | |
_NET_PREFIX="openlab-jobs" | |
export OS_NETWORK_NAME="$_NET_PREFIX-net" | |
export OS_NETWORK_ID="$(openstack network show $OS_NETWORK_NAME -f value -c id)" | |
if [ -z "$OS_NETWORK_ID" ]; then | |
export OS_NETWORK_ID="$(openstack network create $OS_NETWORK_NAME -f value -c id)" | |
openstack subnet create --network $OS_NETWORK_ID --subnet-range 172.16.10.0/24 $_NET_PREFIX-subnet | |
fi | |
export OS_VPC_ID="$(openstack router show $_NET_PREFIX-vpc -f value -c id)" | |
if [ -z "$OS_VPC_ID" ]; then | |
export OS_VPC_ID="$(openstack router create $_NET_PREFIX-vpc -f value -c id)" | |
openstack router add subnet $_NET_PREFIX-vpc $_NET_PREFIX-subnet | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment