summaryrefslogtreecommitdiffstats
path: root/bin/helpers/launch-base
diff options
context:
space:
mode:
Diffstat (limited to 'bin/helpers/launch-base')
-rwxr-xr-xbin/helpers/launch-base56
1 files changed, 5 insertions, 51 deletions
diff --git a/bin/helpers/launch-base b/bin/helpers/launch-base
index c70bcac..7ca91cd 100755
--- a/bin/helpers/launch-base
+++ b/bin/helpers/launch-base
@@ -2,57 +2,11 @@
set -eu
set -o pipefail
-echo "Creating droplet for base..."
-data=$(doctl \
- -t "$(cat /mnt/digitalocean)" \
- compute droplet create \
- base \
- --image debian-9-x64 \
- --region nyc3 \
- --size s-1vcpu-1gb \
- --ssh-keys 23160354 \
- --format ID,PublicIPv4 \
- --no-header \
- --wait)
-id=$(echo "$data" | awk '{print $1}')
-ip=$(echo "$data" | awk '{print $2}')
-echo "Created droplet with id $id and ip $ip"
+# shellcheck source=functions.sh
+. "$(dirname "$0")/functions.sh"
-echo "Provisioning droplet..."
+create_droplet base
-conf_location="/usr/local/share/puppet-tozt"
-conf_repo="git://github.com/doy/puppet-tozt"
+provision_droplet base
-remote() {
- # shellcheck disable=SC2029
- ssh -oStrictHostKeyChecking=accept-new root@"$ip" "$@"
-}
-
-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
-
-echo "Done provisioning"
+echo "Done"