Day zero scripts to create and delete a VM with a single execution.

This commit is contained in:
John McCardle 2022-02-08 20:55:33 -05:00
commit b66f1bcadd
2 changed files with 63 additions and 0 deletions

27
day0_delete.sh Executable file
View file

@ -0,0 +1,27 @@
#!/bin/bash
#
# Day 0 - Delete script
# Requires linode-cli to be installed (`pip3 install linode-cli`)
#
# The command used below looks like this from command line:
#linode-cli linodes list --format 'id' --label UpskillChallengeNode --text
#id
#34628226
# change the target of this delete script by giving a LABEL value, like this:
# LABEL=DeleteThisNode ./day0_delete.sh
# otherwise, the default "UpskillChallengeNode" will be deleted
if [ -z "$LABEL"]
then
LABEL="UpskillChallengeNode"
fi
ID=$(linode-cli linodes list --format 'id' --label "$LABEL" --text | tail -n 1)
echo $ID
linode-cli linodes delete "$ID"