summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2018-10-13 23:38:17 -0400
committerJesse Luehrs <doy@tozt.net>2018-10-13 23:38:17 -0400
commit8739443da3bf2fb5394a5330700ed6970994f871 (patch)
treedb760ee55dba8e69b3a42f6605355cd36af0107e /bin
parent2d7386ad1608042efaeaab908ac376298b6895d3 (diff)
downloadpuppet-tozt-8739443da3bf2fb5394a5330700ed6970994f871.tar.gz
puppet-tozt-8739443da3bf2fb5394a5330700ed6970994f871.zip
move scripts into a bin directory
Diffstat (limited to 'bin')
-rwxr-xr-xbin/bootstrap37
-rwxr-xr-xbin/sync-secrets7
2 files changed, 44 insertions, 0 deletions
diff --git a/bin/bootstrap b/bin/bootstrap
new file mode 100755
index 0000000..bd7929f
--- /dev/null
+++ b/bin/bootstrap
@@ -0,0 +1,37 @@
+#!/usr/bin/env bash
+set -eux
+set -o pipefail
+
+host="${1:-new.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"
+}
+
+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/sync-secrets b/bin/sync-secrets
new file mode 100755
index 0000000..e4e9592
--- /dev/null
+++ b/bin/sync-secrets
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+set -eux
+set -o pipefail
+
+host="${1:-new.tozt.net}"
+
+rsync -avz --delete /mnt/puppet/. root@"$host":/usr/local/share/puppet-tozt/modules/secret/files