canonical / canonical/cloud-init
cc-set-hostname (hostname and fqdn) are not working on google cloud VMs Ubuntu 24.04
- Dominant language
- Python
- Stars
- 3.8k
- Forks
- 1.1k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 18
Description
# Bug report
The steps here do not seem to impact the hostname on google cloud VMs:
https://cloudinit.readthedocs.io/en/latest/reference/modules.html#mod-cc-set-hostname
## Steps to reproduce the problem
This cloud-init.yaml file, when used to launch a virtual machine on Google Cloud, does not make any changes to the hostname.
```yaml
## template: jinja
#cloud-init
{% set HOSTNAME = 'www' %}
{% set FQDN = 'www.example.com' %}
hostname: {{ HOSTNAME }}
fqdn: {{ FQDN }}
prefer_fqdn_over_hostname: true
```
This is tested with the `hostname` command, once the machine boots up.
## Environment details
- Cloud-init version: cloud-init 24.4-0ubuntu1~24.04.2
- Operating System Distribution: Ubuntu 24.04.2
- Cloud provider, platform or installer type: Google Cloud
Contributor guide
Assessment
This issue has not been assessed yet.