Day zero scripts to create and delete a VM with a single execution.
This commit is contained in:
parent
d3f4dff70a
commit
b66f1bcadd
2 changed files with 63 additions and 0 deletions
27
day0_delete.sh
Executable file
27
day0_delete.sh
Executable 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"
|
||||
|
||||
Reference in a new issue