UbuntuIRC / 2022 /04 /29 /#cloud-init.txt
niansa
Initial commit
4aa5fce
=== Guest44454 is now known as ice10001
[03:35] <ice10001> Hi all, anyone able to help with adding repositories (apt) to my custom user-data file, & updating, then installing latest software?
[14:30] <holmanb> ice10001: hello, did you see/test the issue blackboxsw pointed out yesterday?
[14:32] <minimal> holmanb: re the Alpine lxc chat the other day, you are using lxc (container) rather than lxd (vm), right? I find the current lxc/lxd situation confusing due to the somewhat interchangable use of the 2 terms
[14:32] <holmanb> minimal: I find it just as confusing tbh - I was using them interchangably, since the lxc command can by used to initialize both iirc
[14:33] <holmanb> minimal: but yes, I ususually use it for containers, only vms occasionally with lx[cd]
[14:33] <amessyroom> I'm learning cloud-init and am having some confusing on the difference of /etc/cloud.cfg and the files in /etc/cloud.cfg.d . Does the /etc/cloud.cfg define which modules to run; and then the details (parameters) are defined in individual files in cloud.cfg.d ? It seems when the system boot it says it cannot find anything to do; but I have multiple files in /etc/cloud.cfg.d and have also tried concating these files into /etc/cloud/clooud.c
[14:33] <minimal> holmanb: yeah, from a cloud-init perspective it seems that LXD (vm) uses LXD datasource, whereas lxc (container) uses NoCloud datasource
[14:35] <holmanb> minimal: I think lxd datasource supports both
[14:35] <minimal> amessyroom: generally you specify "what to do" in the user-data / meta-data / network-config rather than in those files
[14:38] <amessyroom> hmmm. but can user data be pre-created into the image, rather than pasted into a gui dialogue box i.e. azure . I'm trying to make a gold image that will build swap; register rh; update packages; and don't want to paste commands or put it in a file and have to pass it as a parameter.
[14:39] <amessyroom> i've not used user data; but just read there is a user-data area in /var/lib/cloud/seed/<datasource>/user-data so being azure will be my datasource I guess I can put things there ?
[14:41] <minimal> amessyroom: yes, seeds files are AFAIK a way to achieve what you want
[14:41] <minimal> from https://cloudinit.readthedocs.io/en/latest/topics/instancedata.html?highlight=seed#what-is-instance-data "cloud-config seed files in the booted cloud image or distribution"
[14:45] <amessyroom> thanks. i'll give that a try. kinda confusing it seems you have multiple ways to do things but user-data seems to be the most used; trying to follow microsoft azure docs and have find that although helpful don't seem to have everything you need to understand to implement :-(
[14:52] <minimal> amessyroom: the reason for multiple ways is to provide flexibility. The "normal" method is user user-data which you provide via the cloud provider (UI/API/etc) when an instance/VM is created
[14:52] <minimal> the files in /etc/cloud.cfg and /etc/cloud.cfg.d are generally for enabling/disabling c-i modules and other generate setup, not for providing data to them
[14:53] <minimal> s/generate/general/
[15:03] <falcojr> minimal and holmanb: descriptions here might be helpful: https://linuxcontainers.org/
[15:03] <falcojr> in particular, "LXC provides the basic functionality used under the hood by LXD. However, it should not be confused with the lxc CLI client tool provided by LXD."
[15:04] <falcojr> so any `lxc <command>` is actually using LXD (which under the hood is using LXC)...clear as mud, right?
[15:12] <holmanb> falcojr: thanks :)
[16:51] <Gordon85> Hi there
[16:51] <Gordon85> could someone help me with an issue?
[16:53] <Gordon85> I know that in cloud-config I can refer to gpg url for yum with:  gpgkey: <url>
[16:53] <Gordon85> and that works
[16:53] <Gordon85> but ... how do I do it for apt?
[16:54] <Gordon85> I've tried with gpgkey: ..., and also with key_url: ... and it failed both times
[16:54] <Gordon85> this is my apt section on #cloud-config
[16:55] <Gordon85> apt:
[16:55] <Gordon85>   sources:
[16:55] <Gordon85>     python3:
[16:55] <Gordon85>      - source: "ppa:deadsnakes/ppa"
[16:55] <Gordon85>     terraform:
[16:55] <Gordon85>       source: "deb [arch=amd64] https://apt.releases.hashicorp.com $RELEASE main"
[16:55] <Gordon85>       file: /etc/apt/sources.list.d/hashicorp.list
[16:55] <Gordon85>       gpgcheck: true
[16:55] <Gordon85>       gpgkey: https://apt.releases.hashicorp.com/gpg
[16:55] <Gordon85> what am I doing wrong? or what would be the alternative?, please
[17:25] <holmanb> Gordon85: what's the terraform key for? I assume that is one of your problems
[17:28] <holmanb> ah, nvm that's the key name for a repo
[17:53] <holmanb> Gordon85: Per the docs, gpgcheck and gpgkey are not valid keys for the apt module: https://cloudinit.readthedocs.io/en/latest/topics/modules.html#apt-configure
[18:03] <holmanb> also the url you listed is just a gpg keyfile, I think the apt repo will require a keyserver url and keyid/fingerprint - the examples here might be a good starting point for what you're trying to do: https://cloudinit.readthedocs.io/en/latest/topics/examples.html#additional-apt-configuration-and-repositories
[18:24] <Gordon85> Thank you holmanb I appreciate you taking the time to reply.
[18:24] <Gordon85> I did know the url was a gpg keyfile, but I thought cloud-init would just download it and use it (I didn't understand the whole inner workings behind gpgkey. I know that is the way it works for Yum, gpgkey can point ot a file or even a url)
[18:24] <holmanb> Gordon85: alternative to a keyserver lookup, you can specify the key right in your config
[18:25] <Gordon85> thanks again, I'll check that part of the documentation (I didn't think to check the modules. The examples ... don't work that well for me, I did try keyserver, but ... I might have done something wrong because it didn't work)
[18:51] <blackboxsw> looks like one minor error on our last focal integration test run now that the PPA build our daily recipe. https://github.com/canonical/cloud-init/pull/1420 for a minor integration test fix to clean up jenkins state
[18:51] <ubottu> Pull 1420 in canonical/cloud-init "tests: verify_ordered_items fallback to re.escape if needed" [Open]
[19:47] <blackboxsw> falcojr: I can't recall if you said you were working on an upstart related issue today or not. In the interest of cleaning house I started pulling together a "drop upstart stuff" PR https://github.com/canonical/cloud-init/pull/1421
[19:47] <ubottu> Pull 1421 in canonical/cloud-init "upstart: drop vestigial support for upstart" [Open]