3 # Configure a simple NAS cluster as generated by autocluster..
7 domain_auth="administrator"
10 conf_file="/root/scripts/nas.conf"
12 . /root/scripts/functions
19 Usage: setup_samba.sh [OPTION]
21 -x enable script debugging
22 -c config_file config file to load
23 -U username%password domain authentication
29 ############################
30 # parse command line options
31 temp=$(getopt -n "$prog" -o "axhU:c:" -l help -- "$@")
37 -c) conf_file="$2" ; shift 2 ;;
38 -U) domain_auth="$2" ; shift 2 ;;
44 auth_type=$(sed -r -n -e 's@^auth_method[[:space:]]*=[[:space:]]*(files|winbind)[[:space:]]*$@\1@p' "$conf_file")
49 echo "Unsupported authentication type \"${auth_type}\""
53 domain=$(sed -r -n -e 's@^domain[[:space:]]*=[[:space:]]*([^ ]*)[[:space:]]*$@\1@p' "$conf_file" | tr '[a-z]' '[A-Z]')
55 kdc=$(sed -r -n -e 's@^kdc[[:space:]]*=[[:space:]]*([^ ]*)[[:space:]]*$@\1@p' "$conf_file")
57 mmgetstate | grep active > /dev/null || {
58 echo "GPFS must be running to setup Samba"
62 echo "Enabling ctdb..."
63 onnode -p all chkconfig ctdb on
67 echo "Setting up NSS, PAM, KRB5..."
68 onnode -p all authconfig --update --nostart \
69 --enablewinbindauth --enablewinbind \
70 --disablekrb5 --krb5kdc=$kdc.$domain --krb5realm=$domain
73 echo "Setting up NSS, PAM, KRB5..."
74 onnode -p all authconfig --update --nostart \
75 --disablewinbindauth --disablewinbind \
76 --disablekrb5 --krb5kdc=$kdc.$domain --krb5realm=$domain
80 echo "Configuring services..."
81 onnode -p all "(cd scripts/cluster_configure && \
82 ./cluster-configure.py -t 'templates/rhel/' -vv '$conf_file')"
87 net ads join -U"$domain_auth"
91 echo "Restarting ctdb"
92 onnode -p all "service ctdb restart"
94 # let's hit this with a big hammer...
95 for i in $(seq 1 5) ; do
96 echo "Waiting until healthy"
97 wait_until_healthy 60 && break
98 echo "Nope, restart ctdb..."
99 onnode -p all "service ctdb restart"
102 echo "Waiting for cluster to become healthy"