summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2010-12-06 14:44:38 +1100
committerMartin Schwenke <martin@meltin.net>2010-12-06 14:44:38 +1100
commit8ac971907592f3824b9a8d3b9f7fc7d1622bd882 (patch)
tree546f9e45d0dcce34104c9ffaa29a6ea8b2fd036e /base
parentf99079562f751fcd4618262d2a9957f98e674110 (diff)
downloadautocluster-8ac971907592f3824b9a8d3b9f7fc7d1622bd882.tar.gz
autocluster-8ac971907592f3824b9a8d3b9f7fc7d1622bd882.tar.xz
autocluster-8ac971907592f3824b9a8d3b9f7fc7d1622bd882.zip
Configuration file and wrapper script for simple GPFS-based NAS stack.
Master configuration file for cluster_configure and a wrapper script to hold it all together. The script may eventually become part of cluster_configure. Signed-off-by: Martin Schwenke <martin@meltin.net>
Diffstat (limited to 'base')
-rw-r--r--base/all/root/scripts/gpfs-nas.conf55
-rwxr-xr-xbase/all/root/scripts/setup_cluster.sh106
2 files changed, 161 insertions, 0 deletions
diff --git a/base/all/root/scripts/gpfs-nas.conf b/base/all/root/scripts/gpfs-nas.conf
new file mode 100644
index 0000000..51789df
--- /dev/null
+++ b/base/all/root/scripts/gpfs-nas.conf
@@ -0,0 +1,55 @@
+[DEFAULT]
+cluster = @@CLUSTER@@
+domain = @@DOMAIN@@
+chroot_parent = /var/lib/gpfs-nas-chroot
+scp_chroot = %(chroot_parent)s/scp
+gpfs_default_mountpoint = @@GPFS_DEFAULT_MOUNTPOINT@@
+
+[filesystem:0]
+type = gpfs
+mountpoint = %(gpfs_default_mountpoint)s
+
+[share:data]
+directory = %(gpfs_default_mountpoint)s/data
+filesystem = %(gpfs_default_mountpoint)s
+permissions = 0777
+comment = An example share
+
+[package:ctdb]
+deterministic_ips = 0
+
+[package:vsftpd]
+chroot_dir = %(chroot_parent)s/ftp
+
+[export:vsftpd:data]
+share = data
+
+[package:httpd]
+# This section left intentionally empty.
+
+[export:httpd:data]
+share = data
+
+[package:nfs-utils]
+nfs_hostname = %(cluster)s
+
+[export:nfs-utils:data]
+share = data
+fsid = 834258092
+
+[package:samba]
+workgroup = %(cluster)s
+realm = %(domain)s
+chroot_dir = %(scp_chroot)s
+
+[export:samba:data]
+share = data
+
+[package:openssh-server]
+chroot_dir = %(scp_chroot)s
+
+[export:openssh-server:data]
+share = data
+
+[package:rssh]
+chroot_dir = %(scp_chroot)s
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"