laconic-network-bootstrap/scripts/delete-deployments.sh
David Boreham 37fa49ef15 Use ssh user from config (#2)
Reviewed-on: #2
Co-authored-by: David Boreham <david@bozemanpass.com>
Co-committed-by: David Boreham <david@bozemanpass.com>
2024-07-13 18:51:40 +00:00

30 lines
698 B
Bash
Executable File

#!/usr/bin/env bash
set -e
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source ${SCRIPT_DIR}/lib.sh
if [[ -n "$1" ]]; then
machine_name_prefix=$1
else
echo "Usage: $0 <machine-name-prefix>"
exit 1
fi
echo "Delete deployment dirs on all nodes"
spec_file_name=${machine_name_prefix}-spec.yml
deployment_dir=${machine_name_prefix}-deployment
for (( i=1 ; i<=$node_count ; i++ ));
do
node_name=${machine_name_prefix}-${i}
node_host_name=${node_name}.${machine_domain}
echo "Deleting deployment dir on ${node_name}"
ssh ${ssh_user}@${node_host_name} sudo rm -rf ${deployment_dir}
done