Add "cluster configure" command
authorMartin Schwenke <martin@meltin.net>
Fri, 20 Jun 2014 06:19:27 +0000 (16:19 +1000)
committerMartin Schwenke <martin@meltin.net>
Wed, 2 Jul 2014 04:17:17 +0000 (14:17 +1000)
Signed-off-by: Martin Schwenke <martin@meltin.net>
autocluster
config.d/00base.defconf

index 1f62441146ec800df66853276c963ab6687ed150..a4f6d709df1386b70daa101e59e8fcf8f3f595a9 100755 (executable)
@@ -54,7 +54,7 @@ EOF
   commands:
      base [ create | boot ] ...
 
-     cluster [ destroy | create | update_hosts | boot ] ...
+     cluster [ destroy | create | update_hosts | boot | configure ] ...
 
      create base
            create a base image
@@ -571,6 +571,47 @@ cluster_boot ()
     echo ""
 }
 
+cluster_configure ()
+{
+    announce "cluster configure \"${CLUSTER}\""
+    [ -n "$CLUSTER" ] || die "\$CLUSTER not set"
+
+    local n1="${CLUSTER}n1"
+    local ssh="ssh -o StrictHostKeyChecking=no"
+
+    case "$CLUSTER_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 "$n1" "./scripts/setup_build.sh || true"
+           ;;
+
+       "ad")
+           $ssh "$n1" ./scripts/setup_ad_server.sh
+           ;;
+
+       "samba")
+           [ -n "$CLUSTER_PATTERN" ] || CLUSTER_PATTERN="$CLUSTER"
+
+           local nodes=$(vircmd dominfo "$CLUSTER_PATTERN" 2>/dev/null | \
+               sed -n -e 's/Name: *//p')
+
+           for i in $nodes ; do
+               $ssh "$i" ./scripts/install_gpfs_nas.sh
+           done
+           $ssh "$n1" ./scripts/setup_gpfs.sh
+
+           if [ "$AUTH_METHOD" = "winbind" ]; then
+               args="-UAdministrator%${AD_ADMIN_PASS}"
+           else
+               args=""
+           fi
+           $ssh "$n1" ./scripts/setup_cluster.sh "$args"
+           ;;
+    esac
+}
+
 create_one_node ()
 {
     CLUSTER="$1"
@@ -1357,7 +1398,7 @@ case "$t" in
        actions_init
        for t in "$@" ; do
            case "$t" in
-               destroy|create|update_hosts|boot)
+               destroy|create|update_hosts|boot|configure)
                    actions_add "cluster_${t}" ;;
                *) usage ;;
            esac
index fc4f71e0e8307e3f9dd76034ab33b11bdc2430b2..0633adbbb60c5123d7ce93cb9aa3c38ebddcb48a 100644 (file)
@@ -4,6 +4,9 @@
 
 # Cluster
 
+defconf CLUSTER_TYPE "samba" \
+       "samba|ad|build" "Type of cluster, for configuration stage"
+
 defconf NODES "sofs_front:0-3 rhel_base:4" \
        "<nodes>" "list of node types to create, with associated IP offsets"