Az cli bash wrapper
Jump to navigation
Jump to search
!/usr/bin/env bash
Utility script example. Adjust as needed
set -eu count=3
env=d
env=p if [ $env == "d" ]; then
rgEnv=D
elif [ $env == "p" ]; then
rgEnv=P
else
echo "Unsupported environment. Options: d p" exit 1
fi rgName=g1-$rgEnv
runCmd(){
cmd=$1 az vm run-command invoke --resource-group $rgName --name $vmName --command-id RunShellScript --scripts "$cmd"
}
runScript(){
script=$1 az vm run-command invoke --resource-group $rgName --name $vmName --command-id RunShellScript --scripts @$script
}
for i in $(seq $count); do
diskName="az${env}${i}-k8s_mdisk1-plrs" vmName=az${env}${i}-k8s
echo Adding disk to zfs on vm $vmName in $rgName
diskId=$(az disk show -g $rgName -n $diskName --query 'id' -o tsv) echo Attaching disk $diskId to vm $vmName in $rgName az vm disk attach -g $rgName --vm-name $vmName --name $diskId || true
runScript prepZfs.sh
runCmd "zpool status"
done