/srv/irclogs.ubuntu.com/2022/02/12/#cloud-init.txt

gattyttohello all! thanks for cloudinit it's great00:47
gattyttoI am looking for a way to generate vm names on the fly with cloudinit using random words like LXC does, it's a very useful feature00:48
minimalgattytto: hostnames you mean? that's controlled by the relevant meta-data / user-data00:51
gattyttoyes hostnames but I'd like a "RANDOM" feature like for passwords that generates random hostnames too00:52
minimalgattytto: you could write a patch for cc_set_hostname module to do that00:53
minimalbut that would only work where that module is being used (i.e. DataSource dependant)00:53
minimalsome DataSources provide hostname via metadata server00:54
gattyttoyeah I have some usecase like WHMCS web panel that does00:54
gattyttobut in case it doesn't I know at least I'm getting os image default so I can check00:54
gattyttoI wanted to know if there was already some module around it as I see there are other modules super useful I'm using00:55
minimalit is typically coming from either meta-data or user-data, not OS default00:57
blackboxswgattytto: there is a utility `petname` that could generate that random name for you. You could install that package and invoke it in runcmd setting the hostname to that return value. If you want a bunch of random characters in your hostname, #cloud-config user-data could do that with jinja templates and you might be able to use something like the {%- for i in range(8) %}{{ 'abcdefghijklmnopqrstuvwxyz' | random }}{% endfor %}05:20
kags2100Question, my plan is to deploy a base template using the User-Data file. Then after run cloud-init clean, from that template I can then provision new VMs that are then setup for their specific purpose, like Docker Server, etc. Is this a good idea?10:38
Kags141Question, my plan is to deploy a base template using the User-Data file. Then after run cloud-init clean, from that template I can then provision new VMs that are then setup for their specific purpose, like Docker Server, etc. Is this a good idea?11:03
gattyttoblackboxsw thank you I will try the pet name=)14:58
beantaxifalcojr: Thank you so much for merging in my PR! You noted it was missing some docs changes you'd requested + sent a patch for, and I just found that I'd applied that patch to main by mistake19:39
beantaxiI can bang out a new PR for that change no problem19:40
beantaxiUpdate: I just created #1264 to make the docs change. If you've already made the change or would prefer a different approach, no worries19:58

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