summaryrefslogtreecommitdiffstats
path: root/bin/helpers/launch-tozt
diff options
context:
space:
mode:
Diffstat (limited to 'bin/helpers/launch-tozt')
-rwxr-xr-xbin/helpers/launch-tozt58
1 files changed, 5 insertions, 53 deletions
diff --git a/bin/helpers/launch-tozt b/bin/helpers/launch-tozt
index 0d93aac..006cc1d 100755
--- a/bin/helpers/launch-tozt
+++ b/bin/helpers/launch-tozt
@@ -2,20 +2,10 @@
set -eu
set -o pipefail
-echo "Creating droplet for tozt..."
-id=$(doctl \
- -t "$(cat /mnt/digitalocean)" \
- 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"
+# shellcheck source=functions.sh
+. "$(dirname "$0")/functions.sh"
+
+create_droplet tozt 4206344e-cf4f-11e8-a5a7-0a58ac1465db
echo "Assigning floating ip to tozt..."
# XXX this returns an error for some reason, but actually succeeds:
@@ -28,44 +18,6 @@ doctl \
"$id" || true
echo "Done assigning floating ip"
-echo "Provisioning droplet..."
-
-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/tozt/ root@"$host":/usr/local/share/puppet-tozt/modules/secret/files
-remote "cd '$conf_location' && puppet apply --modulepath=./modules manifests"
+provision_droplet tozt
echo "Done"