@proffsg I will try to clarify as best as I can.
From what I know of using Ubuntu 14.04 in the cloud, if manage_etc_hosts is true and you edit the /etc/hosts file, the hostname will be reset on VM reboot. I understand this happens because the VM is getting its configuration data via the cloud-init process. However, even if your VM hasn’t been rebooted, I suspect changes to /etc/hosts will not persist between reboots, based on how various processes may use the /etc/hosts file.
As indicated in the output of:
…you provided above, you can:
Make changes to the master file in /etc/cloud/templates/hosts.tmpl (instead of /etc/hosts), or:
Change the value of manage_etc_hosts in /etc/cloud/cloud.cfg or cloud-config from user-data, by changing:
If the second option is chosen, you may also want to change the value of preserve_hostname in /etc/cloud/cloud.cfg by changing: