Update nodemgmt-scripts.sh

This commit is contained in:
2019-03-04 01:51:14 -06:00
parent df6d47d2cf
commit f9224f1b33

View File

@@ -1407,23 +1407,44 @@ SERVICE(){
HAPROXY-CONFIG() { HAPROXY-CONFIG() {
echo -e "${idsCL[LightGreen]}Creating HAProxy Config Files${idsCL[Default]}" echo -e "${idsCL[LightGreen]}Creating HAProxy Config Files${idsCL[Default]}"
echo -e "${idsCL[LightGreen]}-------------------------------------------${idsCL[Default]}" echo -e "${idsCL[LightGreen]}-------------------------------------------${idsCL[Default]}"
nid=1 if [[ "${NODESERVICES_CHECK}" = *"haproxy"* ]]; then
for nip in "${NODE_HOSTS[@]}"; do nid=1
if [[ $(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then for nip in "${NODE_HOSTS[@]}"; do
nip='localhost ' if [[ $(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then
NCMD='' nip='localhost '
else NCMD=''
NCMD="ssh root@${nip}" else
fi NCMD="ssh root@${nip}"
echo -en "Creating File on iDS-MySQL${nid} ($nip)... ${idsCL[Default]}" fi
echo -en "Creating File on iDS-MySQL${nid} ($nip)... ${idsCL[Default]}"
${NCMD} "nodemgmt update q" ${NCMD} "nodemgmt update q"
${NCMD} "rm -f /etc/haproxy/haproxy.cfg" ${NCMD} "rm -f /etc/haproxy/haproxy.cfg"
${NCMD} "sed -e 's;%NIP%;${nip};g' ${FOLDER}/templates/haproxy.config > /etc/haproxy/haproxy.cfg" ${NCMD} "sed -e 's;%NIP%;${nip};g' ${FOLDER}/templates/haproxy.config > /etc/haproxy/haproxy.cfg"
echo -e "${idsCL[Green]}COMPLETE${idsCL[Default]}" echo -e "${idsCL[Green]}COMPLETE${idsCL[Default]}"
nid=`expr $nid + 1` nid=`expr $nid + 1`
done done
fi
if [[ "${WEBSERVICES_CHECK}" = *"haproxy"* ]]; then
nid=1
for nip in "${WEB_HOSTS[@]}"; do
if [[ $(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then
nip='localhost '
NCMD=''
else
NCMD="ssh root@${nip}"
fi
echo -en "Creating File on iDS-Webserver${nid} ($nip)... ${idsCL[Default]}"
${NCMD} "nodemgmt update q"
${NCMD} "rm -f /etc/haproxy/haproxy.cfg"
${NCMD} "sed -e 's;%NIP%;${nip};g' ${FOLDER}/templates/haproxy.config > /etc/haproxy/haproxy.cfg"
echo -e "${idsCL[Green]}COMPLETE${idsCL[Default]}"
nid=`expr $nid + 1`
done
fi
SERVICE haproxy reload SERVICE haproxy reload
echo "" echo ""
echo -e "${idsCL[Green]}HAProxy Config Files have been created.${idsCL[Default]}" echo -e "${idsCL[Green]}HAProxy Config Files have been created.${idsCL[Default]}"