[11:23] <slawomir> hello! what is a best way to give an instance a random hostname?
[11:23] <slawomir> now i'm doing something like this:
[11:23] <slawomir> #!/bin/bash
[11:23] <slawomir> HOST=my-random-host-name-${RANDOM}
[11:23] <slawomir> DOMAIN=localdomain
[11:23] <slawomir> hostnamectl set-hostname ${HOST}
[11:23] <slawomir> sed -i "s/^preserve_hostname:.*/preserve_hostname: true" /etc/cloud/cloud.cfg
[11:23] <slawomir> sed -i "s/^127.0.0.1.*/127.0.1.1\t${HOST}.${DOMAIN} ${HOST}\n127.0.0.1\tlocalhost/" /etc/hosts
[11:23] <slawomir> i want to start using #cloud-config configuration
[17:38] <blackboxsw> slawomir (now gone)  should probably be thinking about using jinja template header in cloud-config userdata like the following
[17:38] <blackboxsw> ## template: jinja
[17:38] <blackboxsw> #cloud-config
[17:38] <blackboxsw> {% set HN = 'myhost-' ~ cloud_name ~ '-' ~ region ~ '-' ~ range(1,100) | random %}
[17:38] <blackboxsw> hostname: {{ HN }}
[17:40] <blackboxsw> falcojr: holmanb aciba: 23.4 will be blocked by https://github.com/canonical/cloud-init/issues/4630. init-local timeframe before datasource is detected (in DataSourceNone case) we can't write network-config.json to /v/l/c/instance/network-config.json because the datasource is yet to be detected. This affects subiquity/autoinstall. I'm working a fix and should have a PR up within an hour
[17:40] -ubottu:#cloud-init- Issue 4630 in canonical/cloud-init "'failed stage init-local' while testing autoinstall on Noble" [Open]
[17:40] <blackboxsw> I can reproduce this on live-server install images. dbungert heads up as you talked internally about this potential issue.
[17:40] <dbungert> blackboxsw: saw that, thanks!
[17:56] <blackboxsw> repeated msg: slawomir (now gone)  should probably be thinking about using jinja template header in cloud-config userdata like the following
[17:56] <blackboxsw> 10:38 ## template: jinja
[17:56] <blackboxsw> 10:38 #cloud-config
[17:56] <blackboxsw> 10:38 {% set HN = 'myhost-' ~ cloud_name ~ '-' ~ region ~ '-' ~ range(1,100) | random %}
[17:56] <blackboxsw> 10:38 hostname: {{ HN }}
[17:56] <blackboxsw> meh missed it. will table that for random hostname for now
[19:16] <blackboxsw> falcojr: holmanb I'm testing this now https://github.com/canonical/cloud-init/pull/4635
[19:16] -ubottu:#cloud-init- Pull 4635 in canonical/cloud-init "bug(schema): do not write network-config when instance dir absent" [Open]