Merge "Dont create openstack objects if they exist"
This commit is contained in:
commit
2a558fd536
@ -19,24 +19,26 @@ export OS_CLOUD=openstack_helm
|
||||
: ${OSH_EXT_SUBNET_NAME:="public-subnet"}
|
||||
: ${OSH_EXT_SUBNET:="172.24.4.0/24"}
|
||||
: ${OSH_BR_EX_ADDR:="172.24.4.1/24"}
|
||||
openstack stack create --wait \
|
||||
--parameter network_name=${OSH_EXT_NET_NAME} \
|
||||
--parameter physical_network_name=public \
|
||||
--parameter subnet_name=${OSH_EXT_SUBNET_NAME} \
|
||||
--parameter subnet_cidr=${OSH_EXT_SUBNET} \
|
||||
--parameter subnet_gateway=${OSH_BR_EX_ADDR%/*} \
|
||||
-t ./tools/gate/files/heat-public-net-deployment.yaml \
|
||||
heat-public-net-deployment
|
||||
openstack stack show "heat-public-net-deployment" || \
|
||||
openstack stack create --wait \
|
||||
--parameter network_name=${OSH_EXT_NET_NAME} \
|
||||
--parameter physical_network_name=public \
|
||||
--parameter subnet_name=${OSH_EXT_SUBNET_NAME} \
|
||||
--parameter subnet_cidr=${OSH_EXT_SUBNET} \
|
||||
--parameter subnet_gateway=${OSH_BR_EX_ADDR%/*} \
|
||||
-t ./tools/gate/files/heat-public-net-deployment.yaml \
|
||||
heat-public-net-deployment
|
||||
|
||||
: ${OSH_PRIVATE_SUBNET_POOL:="10.0.0.0/8"}
|
||||
: ${OSH_PRIVATE_SUBNET_POOL_NAME:="shared-default-subnetpool"}
|
||||
: ${OSH_PRIVATE_SUBNET_POOL_DEF_PREFIX:="24"}
|
||||
openstack stack create --wait \
|
||||
--parameter subnet_pool_name=${OSH_PRIVATE_SUBNET_POOL_NAME} \
|
||||
--parameter subnet_pool_prefixes=${OSH_PRIVATE_SUBNET_POOL} \
|
||||
--parameter subnet_pool_default_prefix_length=${OSH_PRIVATE_SUBNET_POOL_DEF_PREFIX} \
|
||||
-t ./tools/gate/files/heat-subnet-pool-deployment.yaml \
|
||||
heat-subnet-pool-deployment
|
||||
openstack stack show "heat-subnet-pool-deployment" || \
|
||||
openstack stack create --wait \
|
||||
--parameter subnet_pool_name=${OSH_PRIVATE_SUBNET_POOL_NAME} \
|
||||
--parameter subnet_pool_prefixes=${OSH_PRIVATE_SUBNET_POOL} \
|
||||
--parameter subnet_pool_default_prefix_length=${OSH_PRIVATE_SUBNET_POOL_DEF_PREFIX} \
|
||||
-t ./tools/gate/files/heat-subnet-pool-deployment.yaml \
|
||||
heat-subnet-pool-deployment
|
||||
|
||||
: ${OSH_EXT_NET_NAME:="public"}
|
||||
: ${OSH_VM_KEY_STACK:="heat-vm-key"}
|
||||
@ -49,17 +51,21 @@ IMAGE_NAME=$(openstack image show -f value -c name \
|
||||
|
||||
# Setup SSH Keypair in Nova
|
||||
mkdir -p ${HOME}/.ssh
|
||||
openstack keypair create --private-key ${HOME}/.ssh/osh_key ${OSH_VM_KEY_STACK}
|
||||
|
||||
|
||||
openstack keypair show "${OSH_VM_KEY_STACK}" || \
|
||||
openstack keypair create --private-key ${HOME}/.ssh/osh_key ${OSH_VM_KEY_STACK}
|
||||
chmod 600 ${HOME}/.ssh/osh_key
|
||||
|
||||
openstack stack create --wait \
|
||||
--parameter public_net=${OSH_EXT_NET_NAME} \
|
||||
--parameter image="${IMAGE_NAME}" \
|
||||
--parameter ssh_key=${OSH_VM_KEY_STACK} \
|
||||
--parameter cidr=${OSH_PRIVATE_SUBNET} \
|
||||
--parameter dns_nameserver=${OSH_BR_EX_ADDR%/*} \
|
||||
-t ./tools/gate/files/heat-basic-vm-deployment.yaml \
|
||||
heat-basic-vm-deployment
|
||||
openstack stack show "heat-basic-vm-deployment" || \
|
||||
openstack stack create --wait \
|
||||
--parameter public_net=${OSH_EXT_NET_NAME} \
|
||||
--parameter image="${IMAGE_NAME}" \
|
||||
--parameter ssh_key=${OSH_VM_KEY_STACK} \
|
||||
--parameter cidr=${OSH_PRIVATE_SUBNET} \
|
||||
--parameter dns_nameserver=${OSH_BR_EX_ADDR%/*} \
|
||||
-t ./tools/gate/files/heat-basic-vm-deployment.yaml \
|
||||
heat-basic-vm-deployment
|
||||
|
||||
FLOATING_IP=$(openstack stack output show \
|
||||
heat-basic-vm-deployment \
|
||||
@ -113,11 +119,12 @@ if openstack service list -f value -c Type | grep -q "^volume"; then
|
||||
DEVS_PRE_ATTACH=$(mktemp)
|
||||
ssh -i ${HOME}/.ssh/osh_key cirros@${FLOATING_IP} lsblk > ${DEVS_PRE_ATTACH}
|
||||
|
||||
openstack stack list show "heat-vm-volume-attach" || \
|
||||
# Create and attach a block device to the instance
|
||||
openstack stack create --wait \
|
||||
--parameter instance_uuid=${INSTANCE_ID} \
|
||||
-t ./tools/gate/files/heat-vm-volume-attach.yaml \
|
||||
heat-vm-volume-attach
|
||||
openstack stack create --wait \
|
||||
--parameter instance_uuid=${INSTANCE_ID} \
|
||||
-t ./tools/gate/files/heat-vm-volume-attach.yaml \
|
||||
heat-vm-volume-attach
|
||||
|
||||
# Get the devices that are present on the instance
|
||||
DEVS_POST_ATTACH=$(mktemp)
|
||||
|
Loading…
x
Reference in New Issue
Block a user