Reputation: 7419
How can I set the hostname of a VM to the VM-Name in OpenStack?
I can set the hostname using cloud-init, but I do not know how to set it to a 'parameter', that is, how to make cloud-init / OpenStack pass in the VM-Name.
Upvotes: 0
Views: 4411
Reputation: 366
That's automatically done when OpenStack metadata services are running. As a matter of facts, if your cloud-images are prepared to use cloud-init, your OpenStack services have the Metadata-Services running, and there is no "preserve_hostname: True" in your cloud-init config (normally at /etc/cloud/cloud.cfg)
Any name that you give to the instance, will be passed as "hostname" vía metadata-services to your instance.
Do the following test in any of your instances. Run the following command:
ec2metadata
If that fails, either the cloud-init software is incomplete, or your metadata-services is not reachable from the instances !.
Upvotes: 1