I have a VM template with Ubuntu 14 on it and am trying to set the hostname when the VM is instantiated with the user input “set_hostname”. Unfortunately the VM is created with the hostname the original image had.
Here is the context for the VM once it is created:
CONTEXT = [
DISK_ID = “1”,
ETH0_CONTEXT_FORCE_IPV4 = “”,
ETH0_DNS = “”,
ETH0_GATEWAY = “”,
ETH0_GATEWAY6 = “”,
ETH0_IP = “192.168.100.11”,
ETH0_IP6 = “”,
ETH0_IP6_ULA = “”,
ETH0_MAC = “02:00:c0:a8:64:0b”,
ETH0_MASK = “”,
ETH0_MTU = “”,
ETH0_NETWORK = “”,
ETH0_SEARCH_DOMAIN = “”,
ETH0_VLAN_ID = “”,
ETH0_VROUTER_IP = “”,
ETH0_VROUTER_IP6 = “”,
ETH0_VROUTER_MANAGEMENT = “”,
NETWORK = “YES”,
SET_HOSTNAME = “LM02”,
SSH_PUBLIC_KEY = “”,
TARGET = “hda” ]
And here is the context for the VM Template it was created from:
CONTEXT = [
NETWORK = “YES”,
SET_HOSTNAME = “$SET_HOSTNAME”,
SSH_PUBLIC_KEY = “$USER[SSH_PUBLIC_KEY]” ]
Despite this the hostname is left as ‘Host01’, which was the hostname on the disk image the template uses.
I feel like this should be a fairly straightforward thing to do, but I am struggling to get this to work.
Thanks in advance.