From: Martin Schwenke Date: Tue, 24 Jun 2014 05:01:16 +0000 (+1000) Subject: Cleanup post-boot cluster configuration X-Git-Tag: autocluster-0.10~53 X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=8a86ce8662ce92b55fc9b164626677d7b30460ab;p=autocluster.git Cleanup post-boot cluster configuration * Single entry point is now setup_cluster.sh. * Rename old setup_cluster.sh to setup_cluster_nas.sh. * Split setup_ad_server.sh into install_ad_server.sh and setup_cluster_ad_server.sh. * Split setup_build.sh into install_build.sh and setup_cluster_build.sh. * Rename setup_gpfs.sh to setup_clusterfs_gpfs.sh. Signed-off-by: Martin Schwenke --- diff --git a/autocluster b/autocluster index efeca12..ccbec87 100755 --- a/autocluster +++ b/autocluster @@ -581,14 +581,13 @@ cluster_configure () 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" + $ssh "$n1" ./scripts/install_packages.sh clusterfs build + $ssh "$n1" ./scripts/setup_cluster.sh build ;; "ad") - $ssh "$n1" ./scripts/setup_ad_server.sh + $ssh "$n1" ./scripts/install_packages.sh ad_server + $ssh "$n1" ./scripts/configure_cluster.sh ad_server ;; "samba") @@ -600,14 +599,8 @@ cluster_configure () for i in $nodes ; do $ssh "$i" ./scripts/install_packages.sh clusterfs nas 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" + $ssh "$n1" ./scripts/setup_cluster.sh clusterfs nas ;; esac } diff --git a/base/all/root/scripts/install_ad_server.sh b/base/all/root/scripts/install_ad_server.sh new file mode 100755 index 0000000..75233c4 --- /dev/null +++ b/base/all/root/scripts/install_ad_server.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +set -e + +echo "Installing Samba4 packages" +yum -y install samba4-dc samba4-python diff --git a/base/all/root/scripts/setup_build.sh b/base/all/root/scripts/install_build.sh similarity index 84% rename from base/all/root/scripts/setup_build.sh rename to base/all/root/scripts/install_build.sh index 4981978..9857e08 100755 --- a/base/all/root/scripts/setup_build.sh +++ b/base/all/root/scripts/install_build.sh @@ -1,15 +1,8 @@ #!/bin/sh -# -# Setup build node -# - -$(dirname $0)/install_gpfs.sh - # Setup RPM development echo "Installing RPM developing and setting up rpm build" yum -y install rpmdevtools -rpmdev-setuptree # Install the performance co-pilot packages to allow building of the # CTDB pmda code. It is OK if this fails (these packages are only @@ -21,3 +14,5 @@ yum -y install pcp-libs pcp-libs-devel echo "Installing Samba build dependencies" yum -y install readline-devel libacl-devel e2fsprogs-devel \ libxslt docbook-utils docbook-style-xsl + +exit 0 diff --git a/base/all/root/scripts/setup_cluster.sh b/base/all/root/scripts/setup_cluster.sh index 66a27ca..2e2d7ea 100755 --- a/base/all/root/scripts/setup_cluster.sh +++ b/base/all/root/scripts/setup_cluster.sh @@ -1,122 +1,23 @@ -#!/bin/bash - -# Configure a simple NAS cluster as generated by autocluster.. - -set -e - -domain_auth="administrator" -auth_type="files" - -conf_file="/root/scripts/nas.conf" - -wait_until_healthy () -{ - local timeout="${1:-120}" - - echo -n "Wait until healthy [<${timeout}] " - - local count=0 - while [ $count -lt $timeout ] ; do - if ctdb nodestatus all >/dev/null ; then - echo "[${count}]" - return 0 - fi - echo -n "." - count=$(($count + 1)) - sleep 1 - done - - echo "[TIMEOUT]" - return 1 -} - -#################### -# show program usage -usage () -{ - cat >&2 < /dev/null || { - echo "GPFS must be running to setup Samba" - exit 1 -} -echo "Enabling ctdb..." -onnode -p all chkconfig ctdb on + path="${dn}/${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 + if [ ! -x "$path" ] ; then + echo "Unable to find script \"${file}\" to setup task \"${task}\"" + exit 1 + fi -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... -for i in $(seq 1 5) ; do - wait_until_healthy 60 && break - echo "Nope, restart ctdb..." - onnode -p all "service ctdb restart" + "$path" || exit $? done - -wait_until_healthy - -echo "Setup done" diff --git a/base/all/root/scripts/setup_ad_server.sh b/base/all/root/scripts/setup_cluster_ad_server.sh similarity index 71% rename from base/all/root/scripts/setup_ad_server.sh rename to base/all/root/scripts/setup_cluster_ad_server.sh index 511c1a4..da2cdc9 100755 --- a/base/all/root/scripts/setup_ad_server.sh +++ b/base/all/root/scripts/setup_cluster_ad_server.sh @@ -1,22 +1,8 @@ -#!/bin/bash +#!/bin/sh -# catch errors set -e -set -E -trap 'es=$?; - echo ERROR: failed in function \"${FUNCNAME}\" at line ${LINENO} of ${BASH_SOURCE[0]} with code $es; - exit $es' ERR -# Make this explicit so we only get RHEL updates to make things nice -# and clear. This duplicates what happens in basic-postinstall.sh but -# we may have just rewound the cluster, so we might be running this on -# the node install of from kickstart. -echo "Updating from YUM repositories" -yum -y update - -# Install samba4 packages -echo "Installing Samba4 packages" -yum -y install samba4-dc samba4-python +# 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_cluster_build.sh new file mode 100755 index 0000000..64ca1a2 --- /dev/null +++ b/base/all/root/scripts/setup_cluster_build.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +# Assume that a build cluster is always a single node :-) + +echo "Running rpmdev-setuptree" +rpmdev-setuptree + +echo "Removing .rpmmacros" +rm -vf /root/.rpmmacros diff --git a/base/all/root/scripts/setup_cluster_nas.sh b/base/all/root/scripts/setup_cluster_nas.sh new file mode 100755 index 0000000..e350761 --- /dev/null +++ b/base/all/root/scripts/setup_cluster_nas.sh @@ -0,0 +1,116 @@ +#!/bin/bash + +# Configure a simple NAS cluster as generated by autocluster.. + +set -e + +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}" + + echo -n "Wait until healthy [<${timeout}] " + + local count=0 + while [ $count -lt $timeout ] ; do + if ctdb nodestatus all >/dev/null ; then + echo "[${count}]" + return 0 + fi + echo -n "." + count=$(($count + 1)) + sleep 1 + done + + echo "[TIMEOUT]" + return 1 +} + +#################### +# show program usage +usage () +{ + cat >&2 <