Scripts to deploy domtool across all hosts
authorClinton Ebadi <clinton@unknownlamer.org>
Sun, 6 Jan 2013 08:57:23 +0000 (03:57 -0500)
committerClinton Ebadi <clinton@unknownlamer.org>
Sun, 6 Jan 2013 08:57:23 +0000 (03:57 -0500)
These have existed for a while, but in my homedir. Builds domtool in
parallel across all hosts. Possible improvements include only building
one copy of domtool per machine architecture.

deploy-domtool [new file with mode: 0755]
deploy-domtool-on-host [new file with mode: 0755]

diff --git a/deploy-domtool b/deploy-domtool
new file mode 100755 (executable)
index 0000000..5028e68
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/bash -e
+
+# deploy domtool to all machines
+
+HOSTS_SERVER="deleuze"
+
+# todo: outpost (needs kerberos auth)
+HOSTS_SLAVE="fritz navajos bog hopper mire outpost" 
+
+for master in $HOSTS_SERVER;
+do
+  echo "##### Building MASTER on $master"
+  ssh -K $master /afs/hcoop.net/common/etc/scripts/deploy-domtool-on-host --server
+done
+
+function build_slave ()
+{
+  echo "##### Building SLAVE on $1"
+  ssh -K $1 /afs/hcoop.net/common/etc/scripts/deploy-domtool-on-host --slave
+  echo "##### FINISHED Building SLAVE on $1"
+}
+
+export -f build_slave
+
+echo $HOSTS_SLAVE | parallel -j 10 -d ' ' build_slave {}
+
+#for slave in $HOSTS_SLAVE;
+#do
+#  echo "##### Building SLAVE on $slave"
+#  ssh -K $slave ~clinton_admin/deploy-domtool-on-host.sh --slave
+#done
\ No newline at end of file
diff --git a/deploy-domtool-on-host b/deploy-domtool-on-host
new file mode 100755 (executable)
index 0000000..431e79c
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/bash -e
+
+if [ -z "$1" ]; then
+    echo "Must supply --slave or --server"
+    exit 1
+fi
+
+cd /afs/hcoop.net/common/domtool/build/$(hostname)/domtool2
+
+git checkout release # just in case
+git pull
+
+make
+
+if [ x"$2" = "x--bootstrap" ]; then
+    sudo make install
+    case $1 in
+       --server) 
+           sudo insserv domtool-server
+           ;;
+       --slave)
+           sudo insserv domtool-slave
+           ;;
+    esac
+fi
+
+if [ "$1" = "--server" ]; then
+    echo "Installing Server"
+    sudo make install_server
+fi
+
+if [ "$1" = "--slave" ]; then
+    echo "Installing Slave"
+    sudo make install_slave
+fi
\ No newline at end of file