summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2018-10-19 22:58:34 -0400
committerJesse Luehrs <doy@tozt.net>2018-10-19 22:58:34 -0400
commite4416660bccbf109cd35965510bc8153bd172be9 (patch)
treea3f1a0414f33a30288154a73cea62fcb54899502 /bin
parent0fcb7aea6c32777276fe66e721ca1d5dddd2d48f (diff)
downloadpuppet-tozt-e4416660bccbf109cd35965510bc8153bd172be9.tar.gz
puppet-tozt-e4416660bccbf109cd35965510bc8153bd172be9.zip
make tools recognize the mail host type
Diffstat (limited to 'bin')
-rwxr-xr-xbin/helpers/launch-mail34
-rwxr-xr-xbin/launch2
-rwxr-xr-xbin/secrets2
-rwxr-xr-xbin/terminate2
4 files changed, 38 insertions, 2 deletions
diff --git a/bin/helpers/launch-mail b/bin/helpers/launch-mail
new file mode 100755
index 0000000..91ba123
--- /dev/null
+++ b/bin/helpers/launch-mail
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+set -eu
+set -o pipefail
+
+echo "Creating droplet for mail..."
+id=$(doctl \
+ -t "$(cat /mnt/digitalocean)" \
+ compute droplet create \
+ mail \
+ --image debian-9-x64 \
+ --region nyc3 \
+ --size s-1vcpu-1gb \
+ --ssh-keys 23160354 \
+ --format ID \
+ --no-header \
+ --wait)
+echo "Created droplet with id $id"
+
+echo "Assigning floating ip to mail..."
+# 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 \
+ -t "$(cat /mnt/digitalocean)" \
+ compute floating-ip-action assign \
+ 159.89.254.14 \
+ "$id" || true
+echo "Done assigning floating ip"
+
+echo "Provisioning droplet..."
+
+# ...
+
+echo "Done"
diff --git a/bin/launch b/bin/launch
index ee30dba..dab3edd 100755
--- a/bin/launch
+++ b/bin/launch
@@ -6,7 +6,7 @@ script_path="$(realpath "$(dirname "$0")")"
secrets_bin="${script_path}/secrets"
case "$1" in
- tozt|algo)
+ tozt|algo|mail)
"$secrets_bin" open
trap '"$secrets_bin" close' EXIT
"$(dirname "$0")/helpers/launch-$1"
diff --git a/bin/secrets b/bin/secrets
index e25454b..d42c5de 100755
--- a/bin/secrets
+++ b/bin/secrets
@@ -33,6 +33,8 @@ cmd_sync() {
host="${2:-tozt}"
if [ "${host}" = "tozt" ]; then
hostname=tozt.net
+ elif [ "${host}" = "mail" ]; then
+ hostname=newmail.tozt.net
else
echo "unknown host ${host}" >&2
exit 1
diff --git a/bin/terminate b/bin/terminate
index 23aab67..78f2bab 100755
--- a/bin/terminate
+++ b/bin/terminate
@@ -6,7 +6,7 @@ script_path="$(realpath "$(dirname "$0")")"
secrets_bin="${script_path}/secrets"
case "$1" in
- tozt|algo)
+ tozt|algo|mail)
"$secrets_bin" open
trap '"$secrets_bin" close' EXIT
doctl -t "$(cat /mnt/digitalocean)" compute droplet delete "$1"