summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2014-06-30 16:39:15 +1000
committerMartin Schwenke <martin@meltin.net>2014-07-02 20:26:52 +1000
commitfa26aa2e805ff739f3969892e7e302daa1eaef60 (patch)
tree616e4ec9adb66acd6c526f918e1f218e8e0f1d88 /base
parentec85e5975cba4ebf0db5906562cf0d8198dcd569 (diff)
downloadautocluster-fa26aa2e805ff739f3969892e7e302daa1eaef60.tar.gz
autocluster-fa26aa2e805ff739f3969892e7e302daa1eaef60.tar.xz
autocluster-fa26aa2e805ff739f3969892e7e302daa1eaef60.zip
Rework cluster_setup() to use node types instead of $CLUSTER_TYPE
* Remove configuration variable CLUSTER_TYPE * Add "build" node type * Rename setup scripts for "ad" and "build" node type * Separate out some setup_node_nas.sh from setup_cluster_nas.sh * Make install_packages.sh and cluster_setup.sh more verbose * Separate out clusterfs_setup.sh Signed-off-by: Martin Schwenke <martin@meltin.net>
Diffstat (limited to 'base')
-rwxr-xr-xbase/all/root/scripts/install_ad.sh (renamed from base/all/root/scripts/install_ad_server.sh)0
-rwxr-xr-xbase/all/root/scripts/install_packages.sh6
-rwxr-xr-xbase/all/root/scripts/setup_cluster.sh13
-rwxr-xr-xbase/all/root/scripts/setup_cluster_nas.sh80
-rwxr-xr-xbase/all/root/scripts/setup_clusterfs.sh19
-rwxr-xr-xbase/all/root/scripts/setup_node_ad.sh (renamed from base/all/root/scripts/setup_cluster_ad_server.sh)2
-rwxr-xr-xbase/all/root/scripts/setup_node_build.sh (renamed from base/all/root/scripts/setup_cluster_build.sh)2
-rwxr-xr-xbase/all/root/scripts/setup_node_nas.sh39
8 files changed, 78 insertions, 83 deletions
diff --git a/base/all/root/scripts/install_ad_server.sh b/base/all/root/scripts/install_ad.sh
index 75233c4..75233c4 100755
--- a/base/all/root/scripts/install_ad_server.sh
+++ b/base/all/root/scripts/install_ad.sh
diff --git a/base/all/root/scripts/install_packages.sh b/base/all/root/scripts/install_packages.sh
index 9b023c0..2b6a04c 100755
--- a/base/all/root/scripts/install_packages.sh
+++ b/base/all/root/scripts/install_packages.sh
@@ -1,5 +1,8 @@
#!/bin/sh
+echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
+printf "%% %-66s %%\n" "Install packages doing \"yum update\" on host ${HOSTNAME%%.*}"
+echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
echo "Updating from YUM repositories"
yum -y update
@@ -27,5 +30,8 @@ for task ; do
exit 1
fi
+ echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
+ printf "%% %-66s %%\n" "Install packages task \"${task}\" on host ${HOSTNAME%%.*}"
+ echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
"$path"
done
diff --git a/base/all/root/scripts/setup_cluster.sh b/base/all/root/scripts/setup_cluster.sh
index 2e2d7ea..93aca59 100755
--- a/base/all/root/scripts/setup_cluster.sh
+++ b/base/all/root/scripts/setup_cluster.sh
@@ -3,15 +3,7 @@
dn=$(dirname $0)
for task ; do
- case "$task" in
- clusterfs)
- type="@@CLUSTERFS_TYPE@@"
- file="setup_clusterfs_${type}.sh"
- ;;
- *)
- file="setup_cluster_${task}.sh"
- esac
-
+ file="setup_cluster_${task}.sh"
path="${dn}/${file}"
if [ ! -x "$path" ] ; then
@@ -19,5 +11,8 @@ for task ; do
exit 1
fi
+ echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
+ printf "%% %-66s %%\n" "Setup cluster task \"${task}\""
+ echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
"$path" || exit $?
done
diff --git a/base/all/root/scripts/setup_cluster_nas.sh b/base/all/root/scripts/setup_cluster_nas.sh
index 8f01827..aa0da82 100755
--- a/base/all/root/scripts/setup_cluster_nas.sh
+++ b/base/all/root/scripts/setup_cluster_nas.sh
@@ -4,11 +4,11 @@
set -e
+conf_file="/root/scripts/nas.conf"
+
ad_admin_pass="@@AD_ADMIN_PASS@@"
domain_auth="administrator${ad_admin_pass:+%}${ad_admin_pass}"
-conf_file="/root/scripts/nas.conf"
-
wait_until_healthy ()
{
local timeout="${1:-120}"
@@ -30,84 +30,24 @@ wait_until_healthy ()
return 1
}
-####################
-# show program usage
-usage ()
-{
- cat >&2 <<EOF
-Usage: setup_samba.sh [OPTION]
- options:
- -x enable script debugging
- -c config_file config file to load
- -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 ;;
- --) shift ; break ;;
- -h|--help|*) usage ;;
- esac
-done
-
auth_type=$(sed -r -n -e 's@^auth_method[[:space:]]*=[[:space:]]*(files|winbind)[[:space:]]*$@\1@p' "$conf_file")
case "$auth_type" in
- winbind|files) : ;;
- *)
- echo "Unsupported authentication type \"${auth_type}\""
- usage
-esac
-
-domain=$(sed -r -n -e 's@^domain[[:space:]]*=[[:space:]]*([^ ]*)[[:space:]]*$@\1@p' "$conf_file" | tr '[a-z]' '[A-Z]')
-
-kdc=$(sed -r -n -e 's@^kdc[[:space:]]*=[[:space:]]*([^ ]*)[[:space:]]*$@\1@p' "$conf_file")
-
-case "$auth_type" in
- winbind)
- echo "Setting up NSS, PAM, KRB5..."
- onnode -p all authconfig --update --nostart \
- --enablewinbindauth --enablewinbind \
- --disablekrb5 --krb5kdc=$kdc.$domain --krb5realm=$domain
- ;;
- files)
- echo "Setting up NSS, PAM, KRB5..."
- onnode -p all authconfig --update --nostart \
- --disablewinbindauth --disablewinbind \
- --disablekrb5 --krb5kdc=$kdc.$domain --krb5realm=$domain
- ;;
-esac
-
-echo "Configuring services..."
-onnode -p all "(cd scripts/cluster_configure && \
- ./cluster-configure.py -t 'templates/rhel/' -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"
-
-# let's hit this with a big hammer...
+echo "Restarting ctdb (up to 5 times)"
+# Just in case the cluster doesn't become healthy the first time,
+# repeat a few times...
for i in $(seq 1 5) ; do
- wait_until_healthy 60 && break
- echo "Nope, restart ctdb..."
onnode -p all "service ctdb restart"
+ if wait_until_healthy ; then
+ echo "NAS cluster setup complete"
+ exit 0
+ fi
done
-wait_until_healthy
-
-echo "Setup done"
+exit 1
diff --git a/base/all/root/scripts/setup_clusterfs.sh b/base/all/root/scripts/setup_clusterfs.sh
new file mode 100755
index 0000000..ec7c3e9
--- /dev/null
+++ b/base/all/root/scripts/setup_clusterfs.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+dn=$(dirname $0)
+
+for task ; do
+ type="@@CLUSTERFS_TYPE@@"
+ file="setup_clusterfs_${type}.sh"
+ path="${dn}/${file}"
+
+ if [ ! -x "$path" ] ; then
+ echo "Unable to find script \"${file}\" to setup task \"${task}\""
+ exit 1
+ fi
+
+ echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
+ printf "%% %-66s %%\n" "Setup clusterfs task \"${task}\""
+ echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
+ "$path" || exit $?
+done
diff --git a/base/all/root/scripts/setup_cluster_ad_server.sh b/base/all/root/scripts/setup_node_ad.sh
index da2cdc9..7714e8c 100755
--- a/base/all/root/scripts/setup_cluster_ad_server.sh
+++ b/base/all/root/scripts/setup_node_ad.sh
@@ -2,8 +2,6 @@
set -e
-# Assume that an AD server cluster is always a single node :-)
-
# Remove samba3 configuration file
rm -f /etc/samba/smb.conf
diff --git a/base/all/root/scripts/setup_cluster_build.sh b/base/all/root/scripts/setup_node_build.sh
index 64ca1a2..04d18b6 100755
--- a/base/all/root/scripts/setup_cluster_build.sh
+++ b/base/all/root/scripts/setup_node_build.sh
@@ -1,7 +1,5 @@
#!/bin/sh
-# Assume that a build cluster is always a single node :-)
-
echo "Running rpmdev-setuptree"
rpmdev-setuptree
diff --git a/base/all/root/scripts/setup_node_nas.sh b/base/all/root/scripts/setup_node_nas.sh
new file mode 100755
index 0000000..65fd966
--- /dev/null
+++ b/base/all/root/scripts/setup_node_nas.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+# Per-node NAS cluster configuration steps
+
+set -e
+
+conf_file="/root/scripts/nas.conf"
+
+auth_type=$(sed -r -n -e 's@^auth_method[[:space:]]*=[[:space:]]*(files|winbind)[[:space:]]*$@\1@p' "$conf_file")
+
+case "$auth_type" in
+ winbind|files) : ;;
+ *)
+ echo "Unsupported authentication type \"${auth_type}\""
+ usage
+esac
+
+domain=$(sed -r -n -e 's@^domain[[:space:]]*=[[:space:]]*([^ ]*)[[:space:]]*$@\1@p' "$conf_file" | tr '[a-z]' '[A-Z]')
+
+kdc=$(sed -r -n -e 's@^kdc[[:space:]]*=[[:space:]]*([^ ]*)[[:space:]]*$@\1@p' "$conf_file")
+
+case "$auth_type" in
+ winbind)
+ echo "Setting up NSS, PAM, KRB5..."
+ authconfig --update --nostart \
+ --enablewinbindauth --enablewinbind \
+ --disablekrb5 --krb5kdc=$kdc.$domain --krb5realm=$domain
+ ;;
+ files)
+ echo "Setting up NSS, PAM, KRB5..."
+ authconfig --update --nostart \
+ --disablewinbindauth --disablewinbind \
+ --disablekrb5 --krb5kdc=$kdc.$domain --krb5realm=$domain
+ ;;
+esac
+
+echo "Configuring services..."
+(cd scripts/cluster_configure && \
+ ./cluster-configure.py -t "templates/rhel/" -vv "$conf_file")