/srv/irclogs.ubuntu.com/2023/11/28/#cloud-init.txt

slawomirhello! what is a best way to give an instance a random hostname?11:23
slawomirnow i'm doing something like this:11:23
slawomir#!/bin/bash11:23
slawomirHOST=my-random-host-name-${RANDOM}11:23
slawomirDOMAIN=localdomain11:23
slawomirhostnamectl set-hostname ${HOST}11:23
slawomirsed -i "s/^preserve_hostname:.*/preserve_hostname: true" /etc/cloud/cloud.cfg11:23
slawomirsed -i "s/^127.0.0.1.*/127.0.1.1\t${HOST}.${DOMAIN} ${HOST}\n127.0.0.1\tlocalhost/" /etc/hosts11:23
slawomiri want to start using #cloud-config configuration11:23
blackboxswslawomir (now gone)  should probably be thinking about using jinja template header in cloud-config userdata like the following17:38
blackboxsw## template: jinja17:38
blackboxsw#cloud-config17:38
blackboxsw{% set HN = 'myhost-' ~ cloud_name ~ '-' ~ region ~ '-' ~ range(1,100) | random %}17:38
blackboxswhostname: {{ HN }}17:38
blackboxswfalcojr: 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 hour17:40
-ubottu:#cloud-init- Issue 4630 in canonical/cloud-init "'failed stage init-local' while testing autoinstall on Noble" [Open]17:40
blackboxswI can reproduce this on live-server install images. dbungert heads up as you talked internally about this potential issue.17:40
dbungertblackboxsw: saw that, thanks!17:40
blackboxswrepeated msg: slawomir (now gone)  should probably be thinking about using jinja template header in cloud-config userdata like the following17:56
blackboxsw10:38 ## template: jinja17:56
blackboxsw10:38 #cloud-config17:56
blackboxsw10:38 {% set HN = 'myhost-' ~ cloud_name ~ '-' ~ region ~ '-' ~ range(1,100) | random %}17:56
blackboxsw10:38 hostname: {{ HN }}17:56
blackboxswmeh missed it. will table that for random hostname for now17:56
blackboxswfalcojr: holmanb I'm testing this now https://github.com/canonical/cloud-init/pull/463519:16
-ubottu:#cloud-init- Pull 4635 in canonical/cloud-init "bug(schema): do not write network-config when instance dir absent" [Open]19:16

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!