diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index 4d075808..ca3415d9 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -1407,23 +1407,44 @@ SERVICE(){ HAPROXY-CONFIG() { echo -e "${idsCL[LightGreen]}Creating HAProxy Config Files${idsCL[Default]}" echo -e "${idsCL[LightGreen]}-------------------------------------------${idsCL[Default]}" - nid=1 - for nip in "${NODE_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-MySQL${nid} ($nip)... ${idsCL[Default]}" + if [[ "${NODESERVICES_CHECK}" = *"haproxy"* ]]; then + nid=1 + for nip in "${NODE_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-MySQL${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" + ${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 + echo -e "${idsCL[Green]}COMPLETE${idsCL[Default]}" + nid=`expr $nid + 1` + 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 echo "" echo -e "${idsCL[Green]}HAProxy Config Files have been created.${idsCL[Default]}"