/srv/irclogs.ubuntu.com/2022/06/01/#cloud-init.txt

pasha-19I have recently discovered cloud-init,  It appears to have a great deal of potential.  However; from what I have read in the documentation there appear to be considerable gaps.  Part of that discovery came from attempting to merge the default raspberry pi ubuntu meta-data. user-data and network-config files with a set created by rpi-imager.01:28
pasha-19Then comparing the contents to the Cloud-init: Config Examples determining that there appear to be numerous hierarchical groups in each file in the ubuntu config that do not appear in the Cloud-init examples.  From these investigations including reading considerable portions of the https://cloudinit.readthedocs.io/en/latest/; I am coming up with01:28
pasha-19more questions than answers. I wrote about a 7,000 character explanation of what I learned and what I do not understand.  Iss\ there any interest in reviewing my observations to possibly simplify a beginner's  entry into using what appears to be a powerful tool?01:28
pasha-19Good luck with what you are doing; I believe it really has potential.  Perhaps one has to read the source code to determine the answers  I can probably muddle through doing about 1/2 the job in cloud-init then switching to bash scripts where I am slightly less of a novice to complete the process..01:41
pasha-19bye01:41
haroonhello everyone, I'm trying to get cloud-init to setup my network on creation of the vm. I have the following in the user-data https://paste.debian.net/plain/1242650 , however the nameserver and gateway are not set. I specified the actual name of the interface, because I didn't understood the documentation, if this can be random. I hope someone can educate me on my mistake or point me in the09:07
haroonright direction.09:07
acibaHello haroon. According to the doc here: https://cloudinit.readthedocs.io/en/latest/topics/network-config.html, user-data cannot change an instance's network configuration. You could use a system config file or a kernel command if you want to override the Datasource's network metadata.09:29
blackboxswpasha-19, I know we missed you yesterday. If you end up dropping back into channel in the future, we are definitely interested in doc gaps that help in the usability and reducing the ramp-up time for cloud-init consumers. Common pain points/suggestions/contributions are always welcome.16:17
=== esv_ is now known as esv
dchhow does cloudinit decide which user to "install" ssh pubkeys into?19:30
dchI'm not clear if I can/should put some specific config into the image itself, or if this is entirely driven from retrieved metadata19:30
dchAFAICT this can be dropped in /etc/cloud.cfg in a distro-specific section at the end, for example19:39
minimaldch: it doesn't decide, it does what you (i.e. the user-data) tells it to do19:46
dchminimal: fine, semantics. IoW the default user setting is taken from the cloud.cfg if present, and can be overridden or extended via user-data? 19:47
minimaldch: its all documented, use "ssh_authorized_keys" either at the top-level or within a "users:" section19:49
minimalhttps://cloudinit.readthedocs.io/en/latest/topics/modules.html#ssh19:49
minimalhttps://cloudinit.readthedocs.io/en/latest/topics/modules.html#users-and-groups19:49
dchminimal: thanks, got it working now. only need to figure out best way of including this into the custom build.19:56
minimaldch: well you could add a "users:" section to the /etc/cloud/cloud.cfg file of the disk image19:59
minimaldepends also which user you want to do this for...20:00
dchminimal: yes this is what I have done. What was (initially) confusing is that the cloud.cfg file has a `users:\n  -default` section at the top, but its actually provided by the distro settings at the end20:01
Rick41hello everyone, I have a question regarding cloud-init, is there a way to change the directory layout? instead of use /var/lib/cloud, use any other directory?20:03
minimalRick41: why?20:03
minimaldch: you might also have an issue if any user-data also has a "users:" section20:04
Rick41it seems security recommendations are adding noexec to /var, so runcmd won't work from there.20:07
minimalRick41: not sure if its easy to change, but if you can change it then you'll end up with a non-standard directory layout which will at the very least confuse people20:08
Rick41if isn't as easy as changing the config file, then i wont do it.20:09
minimalRick41: there is a cloud_dir setting in /etc/cloud/cloud.cfg that is normally set to "/var/lib/cloud"20:18
minimalhowever I see some hardcoded references to /var/lib/cloud in various parts of the cloud-init source code20:18
blackboxswRick41: seems reminiscent of this bug https://bugs.launchpad.net/cloud-init/+bug/1962343 20:27
ubottuLaunchpad bug 1962343 in cloud-init "VMs hardening with the noexec option in /tmp and /var/tmp which is causing issues to get an IP with cloud-init , reason why the VM takes like 25 min to start" [High, Triaged]20:27
Rick41yes, thanks!20:28
Rick41also found this one: https://bugs.launchpad.net/cloud-init/+bug/183989920:28
blackboxswminimal: if we have vestigial hardcoded /var/lib/cloud references called at runtime, that feels like a bug too. I see some of the references you are alluding to as well.20:28
ubottuLaunchpad bug 1839899 in cloud-init "cloud-init will not run user-data scripts when /var filesystem is mounted with the noexec flag" [Medium, Triaged]20:28
minimalblackboxsw: yeah I just did a quick recursive grep on the source but didn't doublecheck20:33
blackboxswthx for the reference Rick41 I tied the two bugs together with a comment on 1839899 as well so we know to handle both.20:34
blackboxswminimal: +1 same fgrep FTW. looks like reporting logic has as util.fetch_ssl_details() calls that don't observe the "cloud_dir" config directive.20:35
blackboxswand various datasources and utilities that need cleaning up too :/20:35
blackboxswI'm filing a bug on cloud_dir specifically. That config option should be globally honored20:36
minimalI guess the only way to deal with those sort of things is to have testcases that configure everything configurable :-)20:36
blackboxsw+1020:36
blackboxswpytest.mark.parametrize for the win20:37
minimalcloud-init-chaos-monkey perhaps? ;-)20:37
blackboxswall said fixing cloud_dir won't solve the /var/tmp issue for dhclient :/ Need a different bit of work for that to sort cloudinit/temp_utils.py `_tempfile_dir_arg(..., needs_exe=True)` as that defaults to /var/tmp20:39
blackboxswand is not configurable20:39
blackboxswfiled https://bugs.launchpad.net/cloud-init/+bug/1976564 related to cloud_dir not being handled everywhere. this "should" be the right way to handle a noexec /var/lib/cloud filesystem I think. 23:25
ubottuLaunchpad bug 1976564 in cloud-init "cloud-config: cloud_dir setting not honored globalling by cloud-init" [High, Triaged]23:25
blackboxswRick41: ^ FYI for tracking in case you end up adapting cloud_dir setting /var/lib/cloud 23:25

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