summaryrefslogtreecommitdiffstats
path: root/bootstrap
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2017-11-05 01:04:20 -0500
committerJesse Luehrs <doy@tozt.net>2017-11-05 01:04:20 -0500
commitc863b84562ae1438cc8476e2b2aa5a5da3b9ab46 (patch)
tree352ca9ff48e869e26729ca65b0e161f820f58a42 /bootstrap
parentbde4c815d31cda0b9712037aad5de63431c48b33 (diff)
downloadpuppet-tozt-c863b84562ae1438cc8476e2b2aa5a5da3b9ab46.tar.gz
puppet-tozt-c863b84562ae1438cc8476e2b2aa5a5da3b9ab46.zip
more refactoring of the bootstrap script
and put the config somewhere more permanent, since we'll want to be able to use the puppet config for ongoing maintenance
Diffstat (limited to 'bootstrap')
-rwxr-xr-xbootstrap26
1 files changed, 16 insertions, 10 deletions
diff --git a/bootstrap b/bootstrap
index 574c6f8..6b84b51 100755
--- a/bootstrap
+++ b/bootstrap
@@ -3,24 +3,30 @@ set -eux
set -o pipefail
host="$1"
+conf_location="/usr/local/share/bootstrap-tozt"
+conf_repo="git://github.com/doy/bootstrap-tozt"
remote() {
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"
+}
+
if remote test ! -e /usr/bin/pacman; then
remote apt-get -y update
remote apt-get -y install git
- remote "cd /tmp && git clone git://github.com/doy/bootstrap-tozt"
- remote "cd /tmp/bootstrap-tozt && git submodule update --init"
- remote "cd /tmp/bootstrap-tozt/digitalocean-debian-to-arch && bash install.sh --i_understand_that_this_droplet_will_be_completely_wiped --extra_packages 'puppet git ruby-shadow'"
+ 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
fi
-if remote test -d /tmp/bootstrap-tozt; then
- remote "cd /tmp/bootstrap-tozt && git pull"
-else
- remote "cd /tmp && git clone git://github.com/doy/bootstrap-tozt"
-fi
-
-remote "cd /tmp/bootstrap-tozt && puppet apply --modulepath=./modules manifest.pp"
+ensure_conf_exists
+remote "cd '$conf_location' && puppet apply --modulepath=./modules manifest.pp"