summaryrefslogtreecommitdiffstats
path: root/bin/helpers
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2018-11-13 02:24:46 -0500
committerJesse Luehrs <doy@tozt.net>2018-11-13 02:24:46 -0500
commit7a0d4f29cf3b551af4e33a53fb5c716fdb0e9266 (patch)
treecd9938e3b656cf5c7d18d9af447f602df8e50487 /bin/helpers
parenta4e3bf616ddaead74e808afeed76da56b90b23f6 (diff)
downloadpuppet-tozt-7a0d4f29cf3b551af4e33a53fb5c716fdb0e9266.tar.gz
puppet-tozt-7a0d4f29cf3b551af4e33a53fb5c716fdb0e9266.zip
fix up the launch script a bit
Diffstat (limited to 'bin/helpers')
-rwxr-xr-xbin/helpers/launch-partofme27
1 files changed, 15 insertions, 12 deletions
diff --git a/bin/helpers/launch-partofme b/bin/helpers/launch-partofme
index 7d4ae99..a179861 100755
--- a/bin/helpers/launch-partofme
+++ b/bin/helpers/launch-partofme
@@ -6,20 +6,23 @@ host="${1:-partofme}"
conf_location="/usr/local/share/puppet-tozt"
conf_repo="git://github.com/doy/puppet-tozt"
-remote() {
- # shellcheck disable=SC2029
- ssh root@"$host" "$@"
+ssh_opts="-o ControlMaster=auto -o ControlPath=~/.ssh/puppet-tozt-%r-%h-%p -o ControlPersist=5"
+
+run() {
+ # shellcheck disable=SC2086,SC2029
+ ssh $ssh_opts root@"$host" "$@"
+}
+copy() {
+ # shellcheck disable=SC2086,SC2029
+ scp -r $ssh_opts "$1" root@"$host":"$2"
}
-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"
+run "pacman -S --noconfirm git puppet"
+run "mkdir -p '$conf_location'"
+run "cd '$conf_location' && git clone '$conf_repo' ."
+run "cd '$conf_location' && git submodule update --init --recursive"
-scp -r /mnt/puppet/tozt/ root@"$host":/usr/local/share/puppet-tozt/modules/secret/files
-remote "cd '$conf_location' && puppet apply --modulepath=./modules manifests"
+copy /mnt/puppet/partofme/ /usr/local/share/puppet-tozt/modules/secret/files
+run "cd '$conf_location' && puppet apply --modulepath=./modules manifests"
echo "Done"