Merge "Dont create openstack objects if they exist"

This commit is contained in:
Zuul 2022-07-22 16:53:16 +00:00 committed by Gerrit Code Review
commit 2a558fd536

View File

@ -19,6 +19,7 @@ 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 show "heat-public-net-deployment" || \
openstack stack create --wait \
--parameter network_name=${OSH_EXT_NET_NAME} \
--parameter physical_network_name=public \
@ -31,6 +32,7 @@ openstack stack create --wait \
: ${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 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} \
@ -49,9 +51,13 @@ IMAGE_NAME=$(openstack image show -f value -c name \
# Setup SSH Keypair in Nova
mkdir -p ${HOME}/.ssh
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 show "heat-basic-vm-deployment" || \
openstack stack create --wait \
--parameter public_net=${OSH_EXT_NET_NAME} \
--parameter image="${IMAGE_NAME}" \
@ -113,6 +119,7 @@ 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} \