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

Asked by Justine

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:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

How is this Ubuntu related?

Revision history for this message
Justine (justine-h-deactivatedaccount) said :
#2

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