hostname not getting set as per the dns
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Expired
|
Undecided
|
Unassigned |
Bug Description
Environment Details:
Management Control Plane : OpenStack (Ussuri Release)
cloud-init version : 19.1 (community)
Data Source : Config Drive
OS/platform of deployed VM : RHEL 8.2
I am using cloud-init v19.1 where the control plane (OpenStack nova service) passes information (data source) via configdrive during VM deployment.
I am using set_hostname and update_hostname module under cloud_init_modules section in [1] file. As per the documentation, I have put preserve_hostname: true in the cfg file and rebooted the system(VM). The hostname is preserved and does not change after multiple reboot. This I believe is working as expected.
When we using preserve_host: false and fqdn: <hostname> in [1], the hostname given as input value to fqdn is assigned as the hostname of the VM.
But when we just give preserve_hostname: false in [1], and deploy the VM, the deployed VM name comes as a hostname.
[root@host cloudinit]# hostname
host
Expectation :
If we give preserve_hostname: false it should set the hostname as per the dns what nslookup gives.
If we use an image where preserve_hostname: false, with no hostname specified in the cfg file) and use set_hostname and update_hostname in [1] modules in the cfg file, and deploy few VMs (say 5 VMs ) with it - how will the hostname get configured to all the deployed VMs ? In this use case, we will want the hostname configured on the VM to DNS resolvable and aligned with the IP address associated with the VM. How can this be achieved ?
[1] /etc/cloud/
description: | updated |
description: | updated |
description: | updated |
description: | updated |
Maybe I am misunderstanding this bug.
If unspecified, cloud-init defaults preserve_hostname to False.
When false, cloud-init will take whatever hostname is defined by the cloud metadata and apply it to the system.
You can check what your metadata is providing as local-hostname by running `cloud-init query local_hostname`
Setting preserve_hostname: true means that cloud-init will do nothing with the hostname, even if cloud meta-data states a valid hostname. So the vm would accept hostname settings as provided by DHCP options.