Update nodemgmt-scripts.sh

This commit is contained in:
2022-11-08 18:35:02 -06:00
parent 7fd70f70c4
commit d17c2259ff

View File

@@ -1941,7 +1941,8 @@ VCENTER-SSL(){
CERTDIR="${BASECERTDIR}/${VCHOSTNAME}"
SERVER="https://${VCHOSTNAME}"
CRED="administrator@scity.vs:$(pass iDSVC)"
VCUSER="administrator@scity.vs"
VCUSER="administrator@scity.vs"
CURRENTLIVE=/etc/vmware-rhttpproxy/ssl/rui.crt
echo -en "${idsCL[LightCyan]}Checking days left on vCenter cert... ${idsCL[Default]}"
VCCERTDAYS=$(${FOLDER}/ssl-cert-check/ssl-cert-check -p 443 -s ${VCHOSTNAME} -N)
@@ -1959,7 +1960,17 @@ VCENTER-SSL(){
echo
fi
echo -en "${idsCL[LightCyan]}Updating certificate on vCenter... ${idsCL[Default]}"
LIVEMD5=$(md5sum $CURRENTLIVE | cut -d\ -f1)
CURRENTMD5=$(md5sum $CERT | cut -d\ -f1)
if [ "$LIVEMD5" == "$CURRENTMD5" ]; then
echo -e "${idsCL[Yellow]}Certificates remains the same, no newer certificates exist${idsCL[Default]}"
echo
exit 0
fi
echo -e "${idsCL[Green]}Updating certificates on vCenter... ${idsCL[Default]}"
echo -e "${idsCL[LightCyan]}This process make take up to 10mins${idsCL[Default]}"
echo
# eval $(awk '{ print "export " $1 }' /etc/sysconfig/vmware-environment)
@@ -1986,18 +1997,18 @@ VCENTER-SSL(){
# -d "$REQUEST_BODY"
# curl --insecure -X DELETE "$SERVER/rest/com/vmware/cis/session" -H "vmware-api-session-id: $SESSION_ID"
echo -e "${idsCL[Green]}Done${idsCL[Default]}"
echo
# echo -e "${idsCL[Green]}Done${idsCL[Default]}"
# echo
read -n 1 -s -p "Press any key to continue"
# read -n 1 -s -p "Press any key to continue"
echo -en "${idsCL[LightCyan]}Stopping vCenter services... ${idsCL[Default]}"
ssh -i ~/.ssh/id_rsa root@vcenter.scity.us 'service-control --stop --all' >/dev/null 2>&1
echo -e "${idsCL[Green]}Done${idsCL[Default]}"
echo -en "${idsCL[LightCyan]}Starting vCenter services... ${idsCL[Default]}"
ssh -i ~/.ssh/id_rsa root@vcenter.scity.us 'service-control --start --all' >/dev/null 2>&1
echo -e "${idsCL[Green]}Done${idsCL[Default]}"
# echo -en "${idsCL[LightCyan]}Stopping vCenter services... ${idsCL[Default]}"
# ssh -i ~/.ssh/id_rsa root@vcenter.scity.us 'service-control --stop --all' >/dev/null 2>&1
# echo -e "${idsCL[Green]}Done${idsCL[Default]}"
#
# echo -en "${idsCL[LightCyan]}Starting vCenter services... ${idsCL[Default]}"
# ssh -i ~/.ssh/id_rsa root@vcenter.scity.us 'service-control --start --all' >/dev/null 2>&1
# echo -e "${idsCL[Green]}Done${idsCL[Default]}"
echo
echo -e "${idsCL[Green]}The vCenter certifcate has been updated${idsCL[Default]}"