summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-07-05 19:01:01 -0400
committerJesse Luehrs <doy@tozt.net>2021-07-05 19:01:01 -0400
commit0c7b84faf05e510dfc38f8f69b8a107d1ada8c80 (patch)
tree438f704e6b043d1bcf251900f5a426af87f025c8 /bin
parent573a37010fac2c1ff893257be19a1f2842ce11e1 (diff)
downloadpuppet-tozt-0c7b84faf05e510dfc38f8f69b8a107d1ada8c80.tar.gz
puppet-tozt-0c7b84faf05e510dfc38f8f69b8a107d1ada8c80.zip
start building a new mail server
Diffstat (limited to 'bin')
-rw-r--r--bin/helpers/launch-mail234
-rwxr-xr-xbin/launch18
2 files changed, 43 insertions, 9 deletions
diff --git a/bin/helpers/launch-mail2 b/bin/helpers/launch-mail2
new file mode 100644
index 0000000..38176d7
--- /dev/null
+++ b/bin/helpers/launch-mail2
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+set -eu
+set -o pipefail
+
+# shellcheck source=functions.sh
+. "$(dirname "$0")/functions.sh"
+
+create_droplet mail2.tozt.net s-1vcpu-1gb 0812b69f-dde4-11eb-9b7e-0a58ac1465ad
+
+echo "Creating DNS entry for $ip..."
+record_id=$(
+ doctl \
+ -t "$(cat /mnt/digitalocean)" \
+ compute domain records list \
+ tozt.net \
+ --format Name,Type,ID \
+ --no-header |
+ grep '^smtp2 \+A ' |
+ awk '{print $3}'
+)
+doctl \
+ -t "$(cat /mnt/digitalocean)" \
+ compute domain records update \
+ tozt.net \
+ --record-id "$record_id" \
+ --record-type A \
+ --record-name smtp2 \
+ --record-data "$ip" \
+ --record-ttl 600
+echo "Done creating DNS entry"
+
+provision_droplet mail2
+
+echo "Done"
diff --git a/bin/launch b/bin/launch
index 5ae25a4..2ae4738 100755
--- a/bin/launch
+++ b/bin/launch
@@ -6,13 +6,13 @@ script_path="$(realpath "$(dirname "$0")")"
secrets_bin="${script_path}/secrets"
case "$1" in
- base|tozt|algo|mail|partofme)
- "$secrets_bin" open
- trap '"$secrets_bin" close' EXIT
- "$(dirname "$0")/helpers/launch-$1"
- ;;
- *)
- echo "unknown host $1" >&2
- exit 1
- ;;
+base | tozt | algo | mail | mail2 | partofme)
+ "$secrets_bin" open
+ trap '"$secrets_bin" close' EXIT
+ "$(dirname "$0")/helpers/launch-$1"
+ ;;
+*)
+ echo "unknown host $1" >&2
+ exit 1
+ ;;
esac