If you’re like me then you’ve been annoyed that deploying Ubuntu (and other distros as well) templates using customization specifications doesn’t work – or, it works somewhat sometimes. I am running ESXi 6.0 Update 2 along with vCenter Server Appliance 6.0 Update 2 and have deployed many Ubuntu 14.04 LTS templates and always have to go in and edit /etc/network/interfaces to set the network settings correctly. I’ve also always had to change the hostname to get it to match the VM name. This is all despite having configured a customization file in vSphere to set this for me. So, when Ubuntu 16.04 came out I expected nothing new on this front – however, I was surprised!
I spun up a quick Ubuntu 16.04 template with all my standard requirements and created a customization file to match. The only things I set in the customization file is that the a VM name be entered at deployment and the guest be set to match, I preset the subnet mask and gateway, search domains, primary and secondary DNS, and the user only has to enter the IP of the VM (192.168.50.182 in this case). Of course, this never worked before:
After a few minutes the VM is deployed and… wait a second…
Alas! I haven’t even logged into the VM yet and open-vm-tools is revealing the IP is 192.168.50.182 just as we entered in the template deployment. Awesome! Well, let’s not get too excited – that’s nice, so at least I don’t need to go in the console to setup the network so I can SSH into the VM. But what about the hostname? Well, if you look above you’ll see the DNS Name is “Ubuntu1604Test” just like the VM name. But, let’s see if that’s really the case:
Perfect! In fact, everything we setup for the template deployment is there:
This is great. I am not sure if this is as a result of Ubuntu 16.04 switching over to systemd instead of Canonical’s Upstart or what but I like it. I do still have hit or miss setting config in other distributions (mainly RHEL/CentOS 6 and 7). But I am really glad this is working. Enjoy!