Can set_hostname in cloudinit on centos6.4 image be made to persist across reboot?

Asked by Justine on 2013-09-17

I have a centos6.4 image with cloud-init installed. The image has the default hostname set in /etc/sysconfig/network (HOSTNAME=localhost.localdomain).

When I boot the instance with nova boot, cloud-init sets the hostname to the instance name, which is what I want. However, this hostname does not persist if I reboot the instance - set_hostname will not re-run, and the instance will boot with a hostname derived from the net config (e.g. 172-17-17-4). I would like for the hostname to remain the instance name when I re-boot.

Is there a way to configure cloud.cfg to get set_hostname to run for every boot? Or can set_hostname be locally configured to modify /etc/sysconfig/network? Or should I just modify /etc/sysconfig/network via a user-data script on the first boot?

Any help appreciated,
Justine

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu cloud-init Edit question
Assignee:
No assignee Edit question
Solved by:
Justine
Solved:
Last query:
Last reply:

How is this Ubuntu related?

Sorry, am trying to launch via openstack on ubuntu 13.04 with initialization via cloud-init, need help, apparently this is not the place.