As many of you know, I am a huge fan of the VCSA (vCenter Server Appliance), not only for its ease of deployment and setup but also the fact that I can easily automate the entire deployment in just under a couple of minutes. I have written about this topic in the past using the vpxd_servicecfg command to automate both VCSA 5.0 and VCSA 5.1. I figured it was probably a good idea to update this for latest VCSA 5.5 which includes several new enhancements to vpxd_servicecfg command such as the VMware Customer Experience Improve Program configuration (vTelemtry) among other options that you can explore by simply running the vpxd_servicecfg on the VCSA.
The other reason I wanted to update this for the latest VCSA 5.5 is that I was working with Engineering last week on a project and several of them did not know about this capability of being able to automate the VCSA configuration. Instead of providing them with the raw commands, I thought I would create an updated script that can be shared with the community so that others could also benefit from it. Lastly, I also did this for myself as I deploy a large amount of VCSA for all sorts of testing that I am doing on a regular basis and this would allow me to quickly speed up my deployment by simply going to my own blog 🙂
Below is a shell script that contains several variables that can be edited based on your environment setup and you can run this script over SSH using something like: ssh root@[VCSA-IP] < configureVCSA.sh
#!/bin/bash
# William Lam
# www.virtuallyghetto.com
# Script to automate VCSA 5.5+ Configurations
# User Configurations
# SSO Administrator password (*protected email*)
SSO_ADMINISTRATOR_PASSWORD=VMware1!
# Join Active Directory (following 5 variables required)
JOIN_AD=0
AD_DOMAIN=primp-industries.com
AD_USER=administrator
AD_PASS=mysupersecurepassword
VCENTER_HOSTNAME=vcenter51-1.primp-industries.com
# Enable NTP
ENABLE_NTP=0
NTP_SERVERS=192.168.1.1
# Enable VMware Customer Experience Improvement Program
ENABLE_VC_TELEMTRY=1
################ DO NOT EDIT BEYOND HERE ################
echo "Accepting VMware EULA ..."
/usr/sbin/vpxd_servicecfg eula accept
if [ ${JOIN_AD} -eq 1 ]; then
echo "Configuring vCenter Server hostname ..."
SHORTHOSTNAME=$(echo ${VCENTER_HOSTNAME} | cut -d. -f1)
/bin/hostname ${VCENTER_HOSTNAME}
echo ${VCENTER_HOSTNAME} > /etc/HOSTNAME
sed -i "s/localhost/${SHORTHOSTNAME}/g" /etc/hosts
echo "Configuring Active Directory ..."
/usr/sbin/vpxd_servicecfg ad write "${AD_USER}" "${AD_PASS}" ${AD_DOMAIN}
fi
echo "Enbaling Time Synchronization ..."
if [ ${ENABLE_NTP} -eq 1 ]; then
/usr/sbin/vpxd_servicecfg timesync write ntp ${NTP_SERVERS}
else
/usr/sbin/vpxd_servicecfg timesync write tools
fi
echo "Configuring vCenter Server Embedded DB ..."
/usr/sbin/vpxd_servicecfg db write embedded
echo "Configuring vCenter Server SSO w/custom *protected email* password ..."
/usr/sbin/vpxd_servicecfg sso write embedded ${SSO_ADMINISTRATOR_PASSWORD}
echo "Starting the vCenter Server Service ..."
/usr/sbin/vpxd_servicecfg service start
if [[ -e /var/log/vmware/phonehome ]] && [[ ${ENABLE_VC_TELEMTRY} -eq 1 ]]; then
echo "Enabling vCenter Server Telemtry ..."
/usr/sbin/vpxd_servicecfg telemetry enable
fi
This is great. Can you add things like setting inventory service size to medium, add AD as identity source & set it as default?
Did you mean the JVM memory settings?
Java max memory target modes:
read : will read settings, in MB
write : will test and save settings, in MB
Java max memory options for write/test:
[tomcat_memsize] [is_memsize] [sps_memsize]
tomcat_memsize - maximum heap size for the Tomcat JVM in megabytes
is_memsize - maximum heap size for the Inventory service JVM in megabytes
sps_memsize - maximum heap size for the SPS service JVM in megabytes
Adding AD Identity Source in SSO is not available through any programmatic/CLI interfaces, due to the SSO Admin APIs not being available, you'll still need to do this by hand
Excellent Info. I will try this at home lab. Currently running VC as a virtual machine (Server 2012 R2). Will make necessary changes to the script to fit my environment and deploy during this weekend.
Thanks