diff options
Diffstat (limited to 'base/all/root/scripts/setup_cluster.sh')
-rwxr-xr-x | base/all/root/scripts/setup_cluster.sh | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/base/all/root/scripts/setup_cluster.sh b/base/all/root/scripts/setup_cluster.sh new file mode 100755 index 0000000..3691fd3 --- /dev/null +++ b/base/all/root/scripts/setup_cluster.sh @@ -0,0 +1,106 @@ +#!/bin/bash + +# Configure a simple NAS cluster as generated by autocluster.. + +set -e + +domain_auth="administrator" +auth_type="files" + +conf_file="/root/scripts/gpfs-nas.conf" + +. /root/scripts/functions + +#################### +# show program usage +usage () +{ + cat >&2 <<EOF +Usage: setup_samba.sh [OPTION] + options: + -x enable script debugging + -c config_file config file to load + -a auth_type authentication type (local, ads) + -U username%password domain authentication +EOF + exit 1 +} + + +############################ +# parse command line options +temp=$(getopt -n "$prog" -o "axhU:c:" -l help -- "$@") +[ $? != 0 ] && usage +eval set -- "$temp" +while true ; do + case "$1" in + -x) set -x; shift ;; + -c) conf_file="$2" ; shift 2 ;; + -a) auth_type="$2" ; shift 2;; + -U) domain_auth="$2" ; shift 2 ;; + --) shift ; break ;; + -h|--help|*) usage ;; + esac +done + +case "$auth_type" in + winbind|files) : ;; + *) + echo "Unsupported authentication type \"${auth_type}\"" + usage +esac + +echo "Enabling NTP and ensuring it is started..." +onnode -p all chkconfig ntpd on +onnode -p all service ntpd restart + +mmgetstate | grep active > /dev/null || { + echo "GPFS must be running to setup Samba" + exit 1 +} + +echo "Enabling ctdb..." +onnode -p all chkconfig ctdb on +onnode -p all touch /etc/ctdb/public_addresses + +case "$auth_type" in + winbind) + echo "Setting up NSS, PAM, KRB5..." + onnode -p all authconfig --update --nostart \ + --enablewinbindauth --enablewinbind \ + --disablekrb5 --krb5kdc=foo.vsofs1.com --krb5realm=vsofs1.com + ;; + files) + echo "Setting up NSS, PAM, KRB5..." + onnode -p all authconfig --update --nostart \ + --disablewinbindauth --disablewinbind \ + --disablekrb5 --krb5kdc=foo.vsofs1.com --krb5realm=vsofs1.com + ;; +esac + +echo "Configuring services..." +onnode -p "(cd scripts/cluster_configure && \ + ./cluster-configure.py -t 'templates/rhel/${auth_type}' -vv '$conf_file')" + +case "$auth_type" in + winbind) + echo "Joining domain" + net ads join -U"$domain_auth" + ;; +esac + +echo "Restarting ctdb" +onnode -p all "service ctdb restart > /dev/null" + +# let's hit this with a big hammer... +for i in $(seq 1 5) ; do + echo "Waiting until healthy" + wait_until_healthy 60 && break + echo "Nope, restart ctdb..." + onnode -p all "service ctdb restart > /dev/null" +done + +echo "Waiting for cluster to become healthy" +wait_until_healthy + +echo "Setup done" |