summaryrefslogtreecommitdiffstats
path: root/bin/helpers
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2018-10-16 03:22:10 -0400
committerJesse Luehrs <doy@tozt.net>2018-10-16 03:22:10 -0400
commitd78e3fe6779b8bccfcc3c05bb5c601de6ffa45ef (patch)
treec2f39e9c89dffa5920f0300b44f378318e1e131e /bin/helpers
parent45a4f9be97f53c729ccf6bbea68225744116f740 (diff)
downloadpuppet-tozt-d78e3fe6779b8bccfcc3c05bb5c601de6ffa45ef.tar.gz
puppet-tozt-d78e3fe6779b8bccfcc3c05bb5c601de6ffa45ef.zip
fix another path
Diffstat (limited to 'bin/helpers')
-rwxr-xr-xbin/helpers/bootstrap-tozt41
-rwxr-xr-xbin/helpers/launch-tozt2
2 files changed, 42 insertions, 1 deletions
diff --git a/bin/helpers/bootstrap-tozt b/bin/helpers/bootstrap-tozt
new file mode 100755
index 0000000..7d8ab75
--- /dev/null
+++ b/bin/helpers/bootstrap-tozt
@@ -0,0 +1,41 @@
+#!/usr/bin/env bash
+set -eux
+set -o pipefail
+
+host="${1:-tozt.net}"
+conf_location="/usr/local/share/puppet-tozt"
+conf_repo="git://github.com/doy/puppet-tozt"
+
+remote() {
+ # shellcheck disable=SC2029
+ ssh root@"$host" "$@"
+}
+
+ensure_conf_exists() {
+ 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"
+}
+
+while ! remote true; do
+ sleep 5
+done
+
+if remote test ! -e /usr/bin/pacman; then
+ remote apt-get -y update
+ remote apt-get -y install git
+ ensure_conf_exists
+ remote "cd '$conf_location/digitalocean-debian-to-arch' && bash install.sh --i_understand_that_this_droplet_will_be_completely_wiped --extra_packages 'puppet git ruby-shadow'"
+ sleep 30
+ while ! remote true; do
+ sleep 30
+ done
+fi
+
+ensure_conf_exists
+scp -r /mnt/puppet/ root@"$host":/usr/local/share/puppet-tozt/modules/secret/files
+remote "cd '$conf_location' && puppet apply --modulepath=./modules -e 'include tozt'"
diff --git a/bin/helpers/launch-tozt b/bin/helpers/launch-tozt
index 06dc07d..5ff8d23 100755
--- a/bin/helpers/launch-tozt
+++ b/bin/helpers/launch-tozt
@@ -23,6 +23,6 @@ doctl compute floating-ip-action assign 138.197.58.11 "$id" || true
echo "Done assigning floating ip"
echo "Provisioning droplet..."
-"$(dirname "$0")/bootstrap"
+"$(dirname "$0")/bootstrap-tozt"
echo "Done"