I have to manage a lot of virtual machines that I create by copying a template (VmWare image).
Now I have the problem that in the template the file
/etc/hostname contains a given name that I want to change for each copy of the template.
The network interface is configured by DHCP. DNS entries exist. The system is a Ubuntu 9.10 server.
I wonder if I can configure the template so that on startup it sets its hostname according to its DNS name.
I could create an init script that parses the IP address, makes a DNS lookup and sets the hostname accordingly.
But is there an easier way?