From b136c51ecef9b0051f7e3f285eaecad358b74c1c Mon Sep 17 00:00:00 2001 From: Catherine Redfield Date: Wed, 3 Jan 2024 14:42:30 -0500 Subject: [PATCH] docs: add create_hostname_file key to module reference examples --- cloudinit/config/cc_set_hostname.py | 9 +++++++++ cloudinit/config/cc_update_hostname.py | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/cloudinit/config/cc_set_hostname.py b/cloudinit/config/cc_set_hostname.py index 2327a2c7cac9..daa0f88d8cd9 100644 --- a/cloudinit/config/cc_set_hostname.py +++ b/cloudinit/config/cc_set_hostname.py @@ -60,10 +60,19 @@ dedent( """\ hostname: myhost + ceate_hostname_file: true fqdn: myhost.example.com prefer_fqdn_over_hostname: true """ ), + dedent( + """\ + # On a machine without an ``/etc/hostname`` file, don't create it + # In most clouds, this will results in a DHCP configured hostname + # provided by the cloud + create_hostname_file: false + """ + ), ], "activate_by_schema_keys": [], } diff --git a/cloudinit/config/cc_update_hostname.py b/cloudinit/config/cc_update_hostname.py index 177b9db4cb7b..0b14abd43595 100644 --- a/cloudinit/config/cc_update_hostname.py +++ b/cloudinit/config/cc_update_hostname.py @@ -65,6 +65,7 @@ fqdn: external.fqdn.me hostname: myhost prefer_fqdn_over_hostname: true + create_hostname_file: true """ ), dedent( @@ -74,6 +75,14 @@ prefer_fqdn_over_hostname: false """ ), + dedent( + """\ + # On a machine without an ``/etc/hostname`` file, don't create it + # In most clouds, this will results in a DHCP configured hostname + # provided by the cloud + create_hostname_file: false + """ + ), ], "frequency": PER_ALWAYS, "activate_by_schema_keys": [],