Remove create_cluster.sh
authorMartin Schwenke <martin@meltin.net>
Fri, 20 Jun 2014 06:31:42 +0000 (16:31 +1000)
committerMartin Schwenke <martin@meltin.net>
Wed, 2 Jul 2014 04:17:17 +0000 (14:17 +1000)
This is now:

  autocluster cluster destroy create update_hosts boot configure

:-)

Signed-off-by: Martin Schwenke <martin@meltin.net>
examples/create_cluster.sh [deleted file]

diff --git a/examples/create_cluster.sh b/examples/create_cluster.sh
deleted file mode 100755 (executable)
index fcac626..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-#!/bin/sh
-
-# Automate cluster creation and configuration using autocluster and
-# various scripts included with autocluster.
-
-# Exit on 1st error.
-set -e
-
-usage ()
-{
-    cat <<EOF
-usage: ./create_cluster.sh <cluster> [ <type> [ <args> ] ]
-          <cluster> - Name of cluster
-          <type> - Type of cluster
-              samba: samba cluster with gpfs (default)
-              build: development node
-                 ad: active directory node
-          <args> - Optional arguments to autocluster"
-
-EOF
-    exit 1
-}
-
-CLUSTER="$1"
-[ -n "$CLUSTER" ] || usage
-shift
-
-TYPE="$1"
-if [ -n "$TYPE" ] ; then
-    case "$TYPE" in
-       build|ad|samba) : ;;
-       *) usage ;;
-    esac
-    shift
-else
-    TYPE="samba"
-fi
-
-die () {
-    echo "$@"
-    exit 1
-}
-
-update_hosts_file ()
-{
-    cluster="$1"
-
-    pat="# autocluster ${cluster}\$|[[:space:]]${cluster}(n|base)[[:digit:]]+"
-
-    t="/etc/hosts.${cluster}"
-    grep -E "$pat" /etc/hosts >"$t" || true
-    if diff -B "$t" "tmp/hosts.${cluster}" >/dev/null ; then
-rm "$t"
-return
-    fi
-
-    old=/etc/hosts.old.autocluster
-    cp /etc/hosts "$old"
-    new=/etc/hosts.new
-    grep -Ev "$pat" "$old" |
-    cat -s - "tmp/hosts.${cluster}" >"$new"
-
-    mv "$new" /etc/hosts
-
-    echo "Made these changes to /etc/hosts:"
-    diff -u "$old" /etc/hosts || true
-}
-
-[ -f "${CLUSTER}.autocluster" ] || die "Missing cluster configuration file ${CLUSTER}.autocluster"
-
-vircmd destroy "$CLUSTER" || true
-autocluster -c "${CLUSTER}.autocluster" "$@" create cluster "$CLUSTER"
-update_hosts_file "$CLUSTER"
-vircmd start "$CLUSTER"
-
-nodes=$(vircmd dominfo "$CLUSTER" 2>/dev/null | sed -n -e 's/Name: *//p')
-
-# Wait for the node
-for i in $nodes ; do
-    waitfor "/var/log/kvm/serial.$i" "login:" 300 || {
-       vircmd destroy "$CLUSTER"
-       die "Failed to create cluster"
-    }
-done
-
-# Run the post-install in sequence on each node.  This is a little
-# more time-consuming than doing it in parallel but if some nodes boot
-# a little slower than other then it gives us a bit more time.  It is
-# also very simple code.  Running the post-install here can be avoided
-# by running it when doing "create base", as originally intended.
-# However, the approach used here is more flexible since a generic
-# base image can be reused.  Note that this might not get the correct
-# nodes for some exotic clusters...
-
-n1="${CLUSTER}n1"
-
-case "$TYPE" in
-    "build")
-       # Build node doesn't really need CTDB/Samba to be installed, if the
-       # packages are not present in the repo, they're skipped.
-       ssh -o StrictHostKeyChecking=no "$n1" "./scripts/setup_build.sh || true"
-       ;;
-
-    "ad")
-       ssh -o StrictHostKeyChecking=no "$n1" ./scripts/setup_ad_server.sh
-       ;;
-
-    "samba")
-       for i in $nodes ; do
-           ssh -o StrictHostKeyChecking=no "$i" ./scripts/install_gpfs_nas.sh
-       done
-       ssh "$n1" ./scripts/setup_gpfs.sh
-
-       auth_method=$(autocluster -c "${CLUSTER}.autocluster" -e 'echo $AUTH_METHOD')
-       if [ "$auth_method" = "winbind" ]; then
-           ad_pw=$(autocluster -c "${CLUSTER}.autocluster" -e 'echo $AD_ADMIN_PASS')
-           args="-UAdministrator%${ad_pw}"
-       else
-           args=""
-       fi
-       ssh "$n1" ./scripts/setup_cluster.sh "$args"
-       ;;
-esac