summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2018-11-13 01:58:41 -0500
committerJesse Luehrs <doy@tozt.net>2018-11-13 01:58:41 -0500
commitac4dc3297a2468b4e499759860c71af0f6e2e82c (patch)
treefa485ced884b21bdc8fdf77f4e85f72939cf2c6e /bin
parent1643a8a76b0a834a97decbecbcbd6eac19430aa1 (diff)
downloadpuppet-tozt-ac4dc3297a2468b4e499759860c71af0f6e2e82c.tar.gz
puppet-tozt-ac4dc3297a2468b4e499759860c71af0f6e2e82c.zip
add config for my local fileserver
Diffstat (limited to 'bin')
-rwxr-xr-xbin/algo-config7
-rw-r--r--bin/helpers/launch-partofme25
-rwxr-xr-xbin/launch2
-rwxr-xr-xbin/secrets2
-rwxr-xr-xbin/terminate2
5 files changed, 33 insertions, 5 deletions
diff --git a/bin/algo-config b/bin/algo-config
index 6304e06..81eca85 100755
--- a/bin/algo-config
+++ b/bin/algo-config
@@ -25,9 +25,10 @@ sed 's|^AllowedIPs.*|AllowedIPs = 10.19.49.0/24, fd9d:bc11:4021::/48, 172.16.0.1
scp "$config_path/tozt-not-captive.conf" root@tozt.net:/etc/wireguard/algo.conf
cp "$config_path/tozt-not-captive.conf" /mnt/puppet/tozt/wireguard
-# bishamon
-sed 's|^AllowedIPs.*|AllowedIPs = 10.19.49.0/24, fd9d:bc11:4021::/48, 172.16.0.1/32|' "$config_path/bishamon.conf" > "$config_path/bishamon-not-captive.conf"
-scp "$config_path/bishamon-not-captive.conf" root@bishamon:/etc/wireguard/algo.conf
+# partofme
+sed 's|^AllowedIPs.*|AllowedIPs = 10.19.49.0/24, fd9d:bc11:4021::/48, 172.16.0.1/32|' "$config_path/partofme.conf" > "$config_path/partofme-not-captive.conf"
+scp "$config_path/partofme-not-captive.conf" root@partofme:/etc/wireguard/algo.conf
+cp "$config_path/partofme-not-captive.conf" /mnt/puppet/partofme/wireguard
# mail
sed 's|^AllowedIPs.*|AllowedIPs = 10.19.49.0/24, fd9d:bc11:4021::/48, 172.16.0.1/32|' "$config_path/mail.conf" > "$config_path/mail-not-captive.conf"
diff --git a/bin/helpers/launch-partofme b/bin/helpers/launch-partofme
new file mode 100644
index 0000000..7d4ae99
--- /dev/null
+++ b/bin/helpers/launch-partofme
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+set -eu
+set -o pipefail
+
+host="${1:-partofme}"
+conf_location="/usr/local/share/puppet-tozt"
+conf_repo="git://github.com/doy/puppet-tozt"
+
+remote() {
+ # shellcheck disable=SC2029
+ ssh root@"$host" "$@"
+}
+
+if remote test -d "$conf_location"; then
+ remote "cd '$conf_location' && git pull"
+else
+ remote "mkdir -p '$conf_location'"
+ remote "cd '$conf_location' && git clone '$conf_repo' ."
+fi
+remote "cd '$conf_location' && git submodule update --init --recursive"
+
+scp -r /mnt/puppet/tozt/ root@"$host":/usr/local/share/puppet-tozt/modules/secret/files
+remote "cd '$conf_location' && puppet apply --modulepath=./modules manifests"
+
+echo "Done"
diff --git a/bin/launch b/bin/launch
index dab3edd..663b176 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|mail)
+ tozt|algo|mail|partofme)
"$secrets_bin" open
trap '"$secrets_bin" close' EXIT
"$(dirname "$0")/helpers/launch-$1"
diff --git a/bin/secrets b/bin/secrets
index 81ba480..ea7aef8 100755
--- a/bin/secrets
+++ b/bin/secrets
@@ -35,6 +35,8 @@ cmd_sync() {
hostname=tozt.net
elif [ "${host}" = "mail" ]; then
hostname=newmail3.tozt.net
+ elif [ "${host}" = "partofme" ]; then
+ hostname=partofme
else
echo "unknown host ${host}" >&2
exit 1
diff --git a/bin/terminate b/bin/terminate
index 78f2bab..5c99407 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|mail)
+ tozt|algo|mail|partofme)
"$secrets_bin" open
trap '"$secrets_bin" close' EXIT
doctl -t "$(cat /mnt/digitalocean)" compute droplet delete "$1"