summaryrefslogtreecommitdiffstats
path: root/bin/launch
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2018-10-14 06:34:46 -0400
committerJesse Luehrs <doy@tozt.net>2018-10-14 06:34:46 -0400
commit15e89564f96458b4b9123b69b1dcb7f2c8ed0efd (patch)
treefaf43c26d567f48103f1a87483fa1ff5e90d47e4 /bin/launch
parent8739443da3bf2fb5394a5330700ed6970994f871 (diff)
downloadpuppet-tozt-15e89564f96458b4b9123b69b1dcb7f2c8ed0efd.tar.gz
puppet-tozt-15e89564f96458b4b9123b69b1dcb7f2c8ed0efd.zip
add some scripts to launch and terminate the machine
Diffstat (limited to 'bin/launch')
-rwxr-xr-xbin/launch30
1 files changed, 30 insertions, 0 deletions
diff --git a/bin/launch b/bin/launch
new file mode 100755
index 0000000..b6db692
--- /dev/null
+++ b/bin/launch
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+set -eu
+set -o pipefail
+
+echo "Creating droplet for tozt..."
+id=$(doctl compute droplet create \
+ tozt \
+ --image debian-9-x64 \
+ --region nyc3 \
+ --size s-1vcpu-1gb \
+ --ssh-keys 23160354 \
+ --volumes 4206344e-cf4f-11e8-a5a7-0a58ac1465db \
+ --format ID \
+ --no-header \
+ --wait)
+echo "Created droplet with id $id"
+
+echo "Assigning floating ip to tozt..."
+# XXX this returns an error for some reason, but actually succeeds:
+# Error: could not assign IP to droplet: json: cannot unmarshal number
+# 2328181259 into Go struct field Action.resource_id of type int
+doctl compute floating-ip-action assign 138.197.58.11 "$id" || true
+echo "Done assigning floating ip"
+
+sleep 5
+
+echo "Provisioning droplet..."
+"$(dirname "$0")/bootstrap"
+
+echo "Done"