I work in a big VMware environment. Something like 95% of our servers are virtual. That makes things real easy for me when someone wants a new server for something. I can spin a new server up in just a few minutes, and just a few clicks of a button.
One of the things VMware gives us is the ability to create virtual machine templates. Also, with templates we can also do really cool things like sysprep Windows templates at the time of deployment, and it’s all built right into vSphere. One thing I like to do also is have a template of Ubuntu Linux on hand in case I want to setup a quick Linux server. For Linux, I prefer to use Open-VM-Tools instead of the native VMware tools for Linux. For me it is just easier to install, and I can update the tools easily with a quick apt-get update.
The drawback to using Open-VM-Tools though is I lose the ability to customize Ubuntu servers at deployment time using the VMware deployment wizard. Sure, I can fill out all the stuff, but when that server is done deploying, none of the static IP info is saved, the hostname hasn’t changed etc.
To fix that, I added this quick little shell script in the home directory of my sudo user. That way, when I deploy a server, all I have to do is login, run that quick script, and I now have my customized server in a matter of minutes.
You can download my script here: (Ubuntu Config Script)
Make sure to make the script executable by running the following:
sudo chmod +x ubuntuconfig.sh
What my script does is creates new hostname, hosts and interfaces config files, changes the old ones to .old, replaces them then reboots. Just follow the prompts to your statically IP’d new Ubuntu server install!