Skip to content
Snippets Groups Projects
Verified Commit 026e90ff authored by Antoine R. Dumont's avatar Antoine R. Dumont
Browse files

azure/resize_disk: Align resource_group computation initialization

This bunch of if...elif...fi is there to reproduce the way the
resource_group and nodename are currently built in the azure infra.

So that we can use those script instead of clicking in the portal ui.

We will either need to:

- factorize that snippet part at some point (which is duplicated in
  add-disk, create-vm and here so far)

- rename our resources in the azure portal
parent 15e2b0fd
No related branches found
No related tags found
No related merge requests found
...@@ -7,22 +7,37 @@ nodename=${1-"dbreplica1"} ...@@ -7,22 +7,37 @@ nodename=${1-"dbreplica1"}
# type # type
type=${2-"db"} type=${2-"db"}
# resource group # disk's size in gb
resource_group="euwest-${type}" disk_size=${3-2048}
# not a choice # not a choice
resource_prefix="euwest"
location=westeurope location=westeurope
resource_group="euwest-${type}"
# disk's size in gb full_nodename="${nodename}-${resource_prefix}"
disk_size=${3-2048}
# Depending on the types, we compute the resource group
# type of node (worker, db, etc...) # worker, db, storage have dedicated shared resource group
# other can be specifically tailored for them
if [ $type = 'worker' ]; then # for workers, it's a shared resource
resource_group="${resource_prefix}-${type}s"
elif [ $type = 'db' ]; then # for dbs as well
resource_group="${resource_prefix}-${type}"
full_nodename="${nodename}"
elif [ $type = 'storage' ]; then
resource_group="${resource_prefix}-server"
else # for other node types (webapp), that is specifically tailored for
resource_group="${resource_prefix}-${nodename}"
fi
# disk's name
disk_name="${nodename}_pgdata0" disk_name="${nodename}_pgdata0"
# deallocate the vm (stop, deallocate) # deallocate the vm (stop, deallocate)
cmd="az vm deallocate \ cmd="az vm deallocate \
--resource-group ${resource_group} \ --resource-group ${resource_group} \
--name ${nodename}" --name ${full_nodename}"
echo $cmd echo $cmd
$cmd $cmd
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment