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

Guest44454Good afternoon everyone, I am really struggling with cloud-init. Can I fire off some questions?00:07
Guest44454The struggle starts with me knowing absolutely 0 (zero) about it00:07
Guest44454But my boss has insisted we use it to spin up our servers in case of disaster00:08
minimalGuest44454: have you started by readings the docs? https://cloudinit.readthedocs.io/en/latest/00:37
Guest38Hello all, does cloud-init has support for lvm ? i don't see nothing mentioned on the documentation.13:53
falcojrGuest38: No, there's nothing for setting up or resizing anything LVM related13:59
minimalfalcojr: growpart (from cloud-utils) does have some lvm support14:26
minimalGuest38: so far I've just added entries to run_cmd in user-data to run pvresize and lvextend14:28
minimalIMHO growing/resizing LVM is not a simple "one size fits all" method - typically I'd want the underlying partition grown to fill the disk and the PV on top of it also grown to fill the partition, but I would not want LVs automatically resized by cloud-init14:30
minimalfalcojr: just checked, growpart can run "lvm pvresize" (I assume after partition has been grown)14:32
falcojrminimal: in cloud-init?14:32
minimalcloud-init typically calls cloud-utils' growpart14:33
falcojryeah, but IIRC, we don't expose any options through cloud-init that work with LVM14:34
minimaldepending on the user-data "growpart" mode setting14:34
minimalI just just pointing out that if growpart is triggered by cloud-init to grow a LVM partition it also will do a pvresize as well14:35
minimalso there's a limited degree of "implicit" support for LVM by viture of using growpart14:36
blackboxswfalcojr: just filed a review for discussion of on your pycloudlibe ec2 test instance launch approach https://github.com/canonical/pycloudlib/pull/18818:16
ubottuPull 188 in canonical/pycloudlib "Enable IPv6 metadata URL on ec2 (SC-924)" [Open]18:16
falcojrblackboxsw: "I'm testing this suggestion now". No problem if you want to keep going with it, but I can make the changes too18:24
blackboxswfalcojr: I'm just trying to make sure my suggestion doesn't actually break our use of pycloudlib :)18:25
falcojrblackboxsw: I see the param now in run_instances documentation (for some reason I didn't before), so I think it should work18:26
blackboxswI think there may be a reason for post-launch IPV6 setup (because cloud-init's doesn't handle IPv6 via the EphermeralDHCPv4 local stage setup). But, maybe this is a non-issue for this iteration because we can specify both HttpProtocolIpv6='enabled' and HttpEndpoint='enabled'18:27
blackboxswI'm not sure if omission of the HttpEndpoint setting will 'disable' ipv4 in this case18:28
falcojrblackboxsw: the one I'm setting in this PR only enables the IPv6 endpoint. v4 still lives too. I can't see how enabling it would break anything else18:29
falcojr(famous last words)18:29
blackboxswspending my time today going through our cloud-config-user-groups.txt docs as they are not deployable without error :/19:07
Guest44454Morning all20:19
Guest44454I was talking yesterday about help with cloud-init on a bare metal local install20:19
Guest44454Can anyone help? My humble question is, how do I do it. I have read the docs (and gravely missed something) as I cannot see how cloud-init starts20:20
Guest44454ANy help with setting up a solution would be appreciated20:21
meenaGuest44454: cloud-init starts on boot, however, it needs a data source that tells it what to do20:23
Guest44454Hi Meena20:23
Guest44454I understand that a 'nocloud' setup means I need to create my config file & place it in the /etc/cloud/ folder on my installation medium? (eg. /etc/cloud/cloud.cfg)20:24
Guest44454Is that correct?20:24
meenaGuest44454: no20:25
meenaNoCloud is either a filesystem or a available via HTTP: https://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html20:26
Guest44454Ok,20:28
Guest44454so,20:28
blackboxsw+1  meena thx. and additionally (and underdocumented) NoCloud can be seeded from /var/lib/cloud/seed/nocloud-net in an image per https://github.com/canonical/cloud-init/blob/main/cloudinit/sources/DataSourceNoCloud.py#L31    Generally the easiest check of how/whether cloud-init can detect your datasource is looking through the script ds-identify which tells cloud-init whether the environment in which it is running looks like 20:28
blackboxswit might be viable20:28
blackboxswds-identify code is here: https://github.com/canonical/cloud-init/blob/main/tools/ds-identify#L836 specifically that function tells cloud-init whether it thinks it will discover NoCloud config details20:29
meenai think one other undocumented thing is that there's no general guidelines on how to do a bare-metal install with cloud-init20:29
Guest44454Here comes probably the noobiest question, please be kind: Where & when & how do I run that command? ds=nocloud[;key=val;key=val]20:30
Guest44454Thanks meena, thats the struggle I was thinking :(20:30
Guest44454Scenario: I am standing in front of new hardware, nothing on it, with a USB stick and ubuntu server20:31
blackboxswmeena/Guest44454 +1 I was thinking we should add this to our upcoming roadmap as well (we've tried carving out time for documentation overhaul, tutorials/howtos etc of which I feel this could be a part of what's needed)20:31
Guest44454blackboxsw I am happy to contribute my journey in this20:32
Guest44454Let me just confirm what I have done in the past:20:33
Guest44454I created my usb drive with ubunutu server, and a bash script on the drive itself. I installed Ubuntu then ran the bash script which updated, upgraded, created users from a called bash script & expired their passwords forcing password changes at login & installed all needed software20:35
Guest44454This works perfectly, but now we are looking to cloud-init20:35
memyselfandubuntHello all, when installing from a mini.iso i get around 360 packages very minimal instalation(which is what i want), but if i install it from the ubuntu-live-server i get around 560 packages without selecting any package group, is it possible to overwrite this in the ubuntu-live-server install (siquibity?)?20:37
minimalGuest44454: generally you start with an OS image already configured with cloud-init enabled, write that to a disk and boot so that cloud-init does its stuff on 1st boot20:37
Guest44454Thanks minimal, this part I also guessed to be right. How do I get the already configured OS written to disk to boot? 'our disk images are +350Gb'20:40
meenaGuest44454: is all of that 350G used??20:41
Guest44454Its our ERP server20:41
meenahttps://cloudinit.readthedocs.io/en/latest/topics/modules.html#growpart20:41
Guest44454No, the hdd space is not full, but our image of working data is 350+ GB20:41
Guest44454I know I can exclude the ERP & rsync after install, so then lets go back to standing in front of a new hardware with a usb drive with ubuntu saerver on it20:43
Guest44454That usb drive contains my config, somewhere?20:43
meenaGuest44454: usually, when creating an image, you shrink / truncate it to the most minimal size. So, a complex application might be somewhere between 500M and 9G. But 350G is… unusual.20:45
Guest44454My 350Gb was raw. Our existing ERP & data20:46
minimalGuest44454: well typically you'd have a disk image and then in the cloud-init user-data you would grow the partitions and copy data onto the machine via smb/nfs/http/etc20:47
minimalrather than bundling data into the disk image20:47
Guest44454Ah ok....20:47
minimalotherwise you'd end up with a disk image designed specifically for *one* machine which really negates the point of creating a disk image/using cloud-init in the first place20:48
meenayeah, bundling data is usually bad, it makes migrations hard20:49
blackboxswGuest44454: ds=nocloud[;key=val;key=val] are directives that folks can use if launching KVM instances though QEMU or if they have access to set SMBIOS settings on their cloud platform, so probably not generally a bare-metal deployment approach. The live-server installer that memyselfandubunt mentioned is generally leveraging cloud-init to setup NoCloud datasource config based on configuration options chosen during install.20:50
Guest44454Just on a call, thanks guys, I have more input :)20:51
Guest44454Back20:57
blackboxswnote that live-serverinstall is also supporting automated-installs https://ubuntu.com/server/docs/install/autoinstall-reference  && https://discourse.ubuntu.com/t/automated-server-install-quickstart/1661420:58
Guest44454Ok, so I shrink my existing, working (lets say new install with all software installed) image & copy it to somewhere on my installation media. (If it is big enough or call it via http ot ftp if I recall correctly?20:59
Guest44454cloud-init will then inflate / install from that image20:59
meenaGuest44454: growpart and resizefs modules is what do that21:00
Guest44454is this an instruction I configure in cloud-init setup?21:00
Guest44454I do feel quite foolish asking the questions all :)21:01
blackboxsw-> have to bail for a bit.   No foolish questions :) only foolish answers 21:01
Guest4445423I am back as new guest name, I was disconnected :P21:02
meenaGuest4445423: you could also /nick a nick we can recognize you under21:04
=== Guest4445423 is now known as ice10001
* meena has something like dyslexia and dyscalculia going on, and couldn't tell Guest4445423 and Guest44454 apart21:04
ice10001Another stupid question, can I copy this conversation as reference?21:04
blackboxswice10001: logs are captured by an IRC bot and published here https://irclogs.ubuntu.com/2022/04/12/%23cloud-init.html21:06
blackboxswso you can reference historical/hysterical conversations in the future21:06
ice10001blackboxsw learning new things every day lol,21:07
minimalice10001: what I do for bare metal (i.e. physical machine) is that as part of the disk image I prepare I create a very small FAT/EXT4 partition labelled "cidata" and I put the meta-data, network-config, user-data YAML file in that partition and enable NoCloud in /etc/cloud/cloud.cfg21:15
minimalthen I use a simple Linux bootable USB stick to boot any physical machine, "dd" the disk image onto the machine's HDD/SSD, mount the cidata partition from the bootstick and edit the YAML files accordingly (i.e. config hostname, IP details, etc) before doing the 1st boot21:17
ice10001Thanks minimal, that part is starting to sound familiar :), where is that partition then? On the same USB install drive?21:17
minimals/from the bootdisk/from the HDD or SSD/21:17
minimalI create it as part of the disk image - depending on whether you're creating for BIOS or UEFI you typically will have more than a single partition required (e.g. UEFI ESP part) so its just a case of adding another very small one with the "cidata" fs label (NoCloud scans for a "cidata" filesystem21:19
ice10001ok, got that21:19
minimalI'm typically creating only a 1MiB partition as the YAML files are no size at all21:20
minimalso the network-config file is where you set DHCP or static IP config etc21:22
minimalmost of the stuff is in the user-data file21:22
ice10001(y)21:23
ice10001so, can I sum up so far:21:23
ice10001minimal: Apologies, I got lost:21:28
ice10001You said: then I use a simple Linux bootable USB stick to boot any physical machine, "dd" the disk image onto the machine's HDD/SSD, mount the cidata partition from the bootstick and edit the YAML files accordingly (i.e. config hostname, IP details, etc) before doing the 1st boot21:29
ice10001If you already booted, how are you doing first boot mentioned at the end of that statement21:29
ice10001minimal: I may have understood this now: You boot the machine with your usb drive, then dd the usb image to the hdd of the machine. So the machine will start with the 'install process" as if it was installing from the usb21:45
minimalice10001: if you "dd" a disk image onto a machine and then boot it there's no installation involved, its just running the OS as provided by the disk image21:51
minimalthe USB stick could be running any Linux distro, its just a way to be able to "dd" the image onto the disk/SSD21:52
ice10001Ok thanks21:52
minimalI've been meaning to setup a PXE-based netboot as an alternative to using a USB stick21:52

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