/srv/irclogs.ubuntu.com/2019/09/05/#cloud-init.txt

otuboI'm gonna leave this question here and leave for lunch because I know it might take some time for someone to pick it up and answer: On this bug https://bugzilla.redhat.com/show_bug.cgi?id=1593010 the systemd-generator and the ds-identify read correctly that the second boot doesn't have any DataSource and, from the logs, they disable cloud-init. But still, on the second boot, the network configuration gets09:55
ubot5bugzilla.redhat.com bug 1593010 in cloud-init "cloud-init network configuration does not persist reboot [RHEL 7.8]" [High,New]09:55
otuboreset to dhcp.09:55
otuboIf anyone has any hint on this, I'll be glad to thank personally on cloud-init summit :-) And now I'm off to lunch, be back soon.09:56
otuboperhaps rharper ^10:34
dunz0rIs there some way I could get cloud-init to "ask" me for the hostname? Doing a template for a vmware-cluster.12:03
nvzdunz0r: :)12:33
nvzguess you beat me here12:33
nvzdunz0r: thanks for mentioning this, I think this could be quite useful at some point I think I may hang out here and get familiarized with the project12:34
dunz0rYeah. This seems really useful to what I'm trying to do, especially since I don't have to reinvent the wheel, like I was planning on first.12:36
nvzwould've been my natural reaction12:37
nvzthis is a really nice looking project12:37
nvzI just can't believe it doesnt appear they've thought of making it have interactivity12:37
nvzWindows has for a long time had that thing where you do an OEM install and on the first run it asks you all those questions12:38
nvzso you can have the system installed but still allow the user to set their timezone, username, update preferences, etc..12:38
dunz0rI can see why there's no interactivity, it isn't supposed to. This is for largescale deployments. Serious stuff12:39
nvzI'm fairly capable in python and this does interest me even though I dont have the kind of need for it right now like you seem to12:39
nvzI had always wandered about being able to configure linux systems like that to be able to have initial config done by the user and it looks like I could easily build that on top of this12:39
nvzlike I just reinstalled debian on my cousin's laptop cause the m.2 ssd died and I had to install to his sata hdd he was using for /home.. and I'd have much rather sent it back to him so it booted up asking him for his user/password/fingerprints, etc..12:41
nvzrather than having to set what I could and leave a README on his desktop explaining the rest12:41
nvzand if I ever start doing more serious stuff with VMs this could really be useful there too12:41
dunz0rnvz: My dream here at work is having ALL configuration in salt-stack and essentially never touch the machines, but that's waaay ahead in the future :)12:46
nvzAh, I'd never heard of salt-stack I thought you were referring to the salt minion thing in cloud-init12:48
nvzI've heard of ansible, puppet, chef, but these things are news to me12:48
nvzwhat amazes me about this cloud-init is like python itself, its well documented and I immediately felt comfortable with it just glancing over the site12:49
nvzit all just makes sense12:49
nvzthese sorts of things can often be so cumbersome they're not really useful12:49
dunz0rnvz: Salt-minion is part of saltstack :)12:50
dunz0rSaltstack is the whole shebang12:50
nvzhmm.. I should probably familiarize with these things they're bound to come of use at some point.. saltstack, ansible, puppet, chef, vagrant, cloud-init12:51
nvzterraform12:51
nvzhmm.. see now this damn saltstack has one of them fancy websites that tells you a whole lot of nothing13:00
Odd_Blokedunz0r: Are you asking for a tool that will help you generate cloud-config?  Or some sort of interactivity in the boot process?13:01
nvzI glanced about 90 seconds at the cloud-init site and I could probably use it like I been doing it for months.. I glance at the saltstack page and I'm still not even sure wth it is13:01
nvzOdd_Bloke: that was the general idea, they want to clone vms and be able to supply things on the first boot13:01
dunz0rOdd_Bloke: Interactivity in the boot-process. The machines aren't on AWS or something like that, so no way to input a config-file13:02
dunz0rnvz: Saltstacks frontpage is awful, yeah. https://docs.saltstack.com/en/latest/ is what you want :)13:03
Odd_Blokedunz0r: Where are these machines?13:03
dunz0rOdd_Bloke: In a VMWare cluster.13:03
nvzdunz0r: they make it sound like something commercial.. is it something you have to buy?13:03
Odd_BlokeInteractivity during boot isn't something that would be generally useful (because most launches that involve cloud-init generally aren't accessible to the user at all until SSH is up).13:04
dunz0rnvz: No, but they have an "enterprise" version. But I've never felt limited by the foss-version.13:04
dunz0rOdd_Bloke: Well, I've got console access.13:04
nvzOdd_Bloke: that is a good point13:05
Odd_BlokeSure, some places you will have it, but that's not generally true.13:05
dunz0rOdd_Bloke: Today we create VMs from a template, set hostname/ip/regenerate ssh-host-keys/etc via the console, and that's a hassle13:05
dunz0rOdd_Bloke: Well, not generally no. But in my particular use case it is13:05
nvzOdd_Bloke: however I don't know of anything that is like this that could offer that OEM installed OS kinda feel and this seems to be ready to build that kinda thing on top of13:05
dunz0rI think I'll write something that gets input from the user during boot and then uses cloud-init to do the actual setup.13:06
dunz0r"user" generally being me or my colleagues13:07
nvzOdd_Bloke: my idea, and mind you I just heard about this project, and glanced breifly at the site.. but is it possible to just ship a cloud-config, then have the bit that allows you to run commands at boot hook something to basically interactively make vendor data?13:07
Odd_BlokeYou could also look at generating a config drive from the input, and attaching that to the instances.13:07
nvzon the first boot that is13:07
Odd_BlokeI think the tricky part would be getting input from the console; cloud-init just runs as a daemon and outputs to the console via syslog.13:09
dunz0rOdd_Bloke: My plan is to write a bash script that interactively asks for hostname and IP, and then generate a cloud.cfg from that info and a base template13:09
dunz0rand THEN use cloud-init via the script to "setup" the machine13:09
nvzthey have things that you can use to have an auto-login getty and such13:10
nvzyou could have the base config set that up then get input and supply that input as vendor data overriding any config as supplied by the user13:10
Odd_BlokeSo vendor-data doesn't override user-data, intentionally; the user should always be in control of their instances, regardless of what their vendor wants the configuration to be.13:11
Odd_Blokedunz0r: You may want to consider having your script generate a config drive: https://askubuntu.com/a/86795813:12
Odd_BlokeThen you can attach that to the VM as you launch it, and cloud-init should find the configuration from it without intervention during boot.13:12
nvzI didn't even read about user data.. when I glanced it over I saw the main cloud-config then I seen the bit about vendor data that it says overrides cloud-config13:12
Odd_BlokeSo cloud-config is really a format; it's YAML with a "#cloud-config" header so cloud-init knows that it's intended to be treated as cloud-config.13:14
Odd_BlokeBoth user-data and vendor-data can specify cloud-config.13:14
nvzyeah I noticed that much.. and I'm a fan of yaml.. when I first heard of it I avoided even looking at it because I thought it was another damn markup language.. years later when I finally looked it over I felt stupid :P13:15
nvzturns out its not Yet Another Markup Language, its YAML Ain't Markup Language13:16
dunz0rWait what:O13:16
Odd_Blokedunz0r: Actually, looking at https://git.launchpad.net/cloud-init/tree/doc/sources/ovf might give you a better way of generating the ISO containing user-data.13:17
Odd_Bloke(I haven't played with VMWare much, so I don't know exactly how to do this, I'm afraid.)13:18
dunz0rOdd_Bloke: Generating an OVF would be a lot more work than what I have in mind, but I appreciate the input :)13:23
Odd_BlokeOK, I'll be interested to see what you come up with! :)13:25
smoseri dont' know how the answer at https://askubuntu.com/questions/867946/cloud-init-and-ova/867958#867958 would work13:28
smoseradmittedly i dont understand lots of things about vmware.  but that does not look like it'd work.13:29
smoseri would expect, though to be able to launch a vm on vmware that had an attached cdrom with a NoCloud datasource on it.13:31
smoseryou can build such a datasource easily with cloud-localds13:31
smoserhttp://atom-lab-3.insieme.local:5880/pijaserami13:31
smosererr... sorry13:31
smoserhttp://paste.ubuntu.com/p/K9CcHyTd2V/13:31
smoserstrike two13:32
smoserhttp://paste.ubuntu.com/p/3GyHXxB2CW/13:32
smoserthere.13:32
smoserstupid finger memory for internal hastebin13:32
otuboif systemd-generator and/or ds-identify disabled cloud-init, it means totally disable or it still runs some things? I'm setting a network configuration with cloud-init, but when I reboot (both scripts identify that there's no datasource any more) and state as disabled13:45
otubobut the network configuration is reset to dhcp instead of the initial configuration which was static13:46
Odd_Blokerharper: blackboxsw: I'm looking at validating a network configuration bug (https://bugs.launchpad.net/cloud-init/+bug/1812857) and I'd really appreciate some guidance as to how best to synthesise a networking environment for testing.13:46
ubot5Launchpad bug 1812857 in cloud-init "RuntimeError: duplicate mac found! both 'ens4' and 'bond0' have mac '9c:XX:XX:46:5d:91'" [Medium,Fix released]13:46
Odd_Blokeotubo: I would expect that they wouldn't run at all, but /var/log/cloud-init.log would tell you the truth of that.13:46
otuboOdd_Bloke: I can see the pretty network configuration box with ascii art on /var/log/messages, setting everything back to dhcp13:48
otuboOdd_Bloke: and I can also see the logs in /run/cloud/ saying no datasource was found the cloud-init will be disabled13:49
otuboI'm a bit puzzled.13:49
otuboOdd_Bloke: I can also see this weird message on the logs, but I'm not sure if this is *causeing* the issue or if it is a *consequence* of the issue, or even not related:13:51
otubohttps://pastebin.com/3NFJkwcK13:51
smoserotubo: if you have the generator enabled correctly13:59
smoserthen cloud-init will not run *at all* if there is no datasource (or it is disabled)13:59
smoserotubo: cat /run/cloud-init/ds-identify.log14:00
smoserand /run/cloud-init/cloud-init-generator.log14:00
otubosmoser: both of them report as disabled, but I'm gonna paste here, sometimes I'm just missing something.14:00
smoserotubo: i suspect you have the services enabled.14:01
smoserthe other services.14:01
otubosmoser: https://pastebin.com/LtdzQG1D14:01
smoseris suspect you have your units (cloud-init.service, cloud-init-local.service, cloud-final.service, cloud-config.service) enabled.14:03
smoseri suspect they are 'WantedBy=multi-user.target'14:03
smoserwhen they should be WantedBy=cloud-init.target14:03
otubolet me check that14:03
smoserthe generator only handles enabling or disabling that target14:03
otubosmoser: bulls eye14:04
otubohttps://pastebin.com/9PwbF6es14:04
smoserotubo: as upstream we'd love to have the generator enabled in rhel packaging14:24
otubosmoser: I'll send a patch soon, once I confirm this is the root cause :-)14:26
otubosmoser: thanks a lot for the help!14:26
rharperOdd_Bloke: yeah, I think launching an lxc with a network-config that has bond0 over eth0, should show that .14:44
Odd_Blokerharper: Yeah, I got that working eventually but NoCloud doesn't seem to trigger the error.14:45
Odd_BlokeI can reproduce the error if I poke the appropriate function in a Python shell, but that seems like cheating. :p14:45
rharperhrm,  it's somewhat related to the speed at which bond0 picksup the mac of the member14:46
rharperIIRC14:46
* rharper re-reads the bug14:46
rharperOdd_Bloke: alternatively, you could boot with the bond0 + eth0 setup; cloud-init clean;  cloud-init init --local14:48
rharperthat should trigger cloud-init seeing bond0 and eth0 with same mac14:48
rharperthat way you don't have to rely on boot timing14:48
Odd_BlokeOh, it's because the error is in openstack's convert_net_json.14:48
Odd_BlokeWell, it's further down, but that's where the traceback comes from.14:48
rharperyeah, they had an ironic deployment14:49
Odd_BlokeAnd NoCloud just passes my network config through verbatim, rather than having to convert it from OpenStack's format.14:49
rharperyes, I guess it's a matter of having get_interfaces() list called14:50
Odd_BlokeI (think I) reproduced in a KVM, but then couldn't get into it (presumably because cloud-init failed before setting my password or SSH keys?).14:50
rharperso either fallback networking, or some other network_config path which triggers that;  and I still think best to clean and then run cloud-init init --local14:50
rharperyou can backdoor the image14:50
rharperwith root passwd first14:50
Odd_BlokeRight, yeah.  Can you remind me how to do that?14:51
rharperyeah, I use  sudo mount-image-callback --system-mounts bionic-server-cloudimg-amd64.img -- chroot _MOUNTPOINT_ /bin/bash14:51
rharperthen passwd14:51
Odd_BlokeThanks!14:53
Odd_Blokerharper: Oh, right, but this is still going to boot with NoCloud.  Do we have a good way of mimicking ConfigDrive locally?15:11
smoserOdd_Bloke: easier than that is15:39
smoser https://gist.github.com/smoser/8c65b8771d5ab1d99c44c285323dfff6/15:39
smoserwell, only slightly easier. but it makes sure that you can get in.15:39
smoserif you just ran 'passwd' and cloud-init got borked, you'd have no ssh host keys15:39
smoserbut wrt config drive.. you can just craft one. easiest way to do it would probably be to just mount an existing and then change things you want.  i think we possibly had a tool to make them at one point. but not sure where.15:41
Odd_BlokeYeah, I do have console access so password is sufficient for this particular case, thankfully.15:53
Odd_BlokeCool, I'll go find an example one for me to poke at.15:53
Odd_BlokeThanks for the advice!15:53
Odd_BlokeOK, so I have a configdrive ISO now; how do I need to invoke kvm/QEMU to have it found properly?16:43
Odd_BlokeOh, my ConfigDrive is invalid.16:58
Odd_BlokeThat sounds like a problem for post-lunch Dan to deal with.16:58
smoserOdd_Bloke: use xkvm. and use '--disk=foo.img'17:17
Odd_Blokesmoser: Do you have a sample config drive I could take and modify?  This tool I found is actually creating a NoCloud source despite having "config_drive" in its name.17:54
smoserthat is odd in deed.17:55
smoserOdd_Bloke: what i'd do is launch a serverStack instance with '--config-drive=1' on the openstack cli17:56
smoserand then dd to get the disk.17:56
smoserthere are probably some examples attached to bugs though17:56
smoserOdd_Bloke: https://bugs.launchpad.net/cloud-init/+bug/167192717:59
ubot5Launchpad bug 1671927 in cloud-init "init local crash - unknown subnet type 'loopback'" [Medium,Fix released]17:59
smoserattachment 'sr0.gz' there is at least a start.17:59
smosersorry, 'config-drive' is the name of the attachment17:59
Odd_BlokeThank you!18:00
Odd_BlokeOh right, except now I need to somehow write OpenStack network config language to reproduce this.18:16
Odd_Blokerharper: You thought we might be able to reproduce this (https://bugs.launchpad.net/cloud-init/+bug/1812857) in a booted instance at stand-up.  Did our conversation change that, when we realised it was ConfigDrive-specific?18:22
ubot5Launchpad bug 1812857 in cloud-init "RuntimeError: duplicate mac found! both 'ens4' and 'bond0' have mac '9c:XX:XX:46:5d:91'" [Medium,Fix released]18:22
Odd_BlokeBecause I really don't want to have to work out how to construct correct OpenStack network_data.json by hand.18:23
rharperit's not config drive specific; it can happen on any path in cloud-init which requires us to use net.get_interfaces()18:23
rharperI don't think we need to, really; I think just bringing up bond0/eth0, and then python3 -c 'from cloudinit import net;  print(net.get_interfaces())'  and ensure that bond0 isn't in the list18:24
Odd_BlokeAre we happy for me to reproduce it in a Python shell then?18:24
rharperI'm fine with that;18:24
Odd_BlokeOK, cool, I'm good with that.18:24
rharperI think it reasonable to show the net config, verify that eth0 and bond0 have the same mac, that cloudinit.net.is_bond() returns true on bond0 , false on eth0; and then that bond0 doesn't show up in get_interfaces();18:26
rharperbefore/after upgrade should show that we do get bond0 in the list and it raises duplicate exception, post-upgrade we don't get the exception and bond0 isn't in the list;18:27
Odd_BlokeOK, cool, I'll continue with my lxd container setup I started on before thinking I might be able to reproduce the exact bug.18:28
Odd_BlokeThanks!18:28
smoserOdd_Bloke: what you need to do is write a renderer for Openstack networking ocnfig in cloud-init18:41
smoserand then you could just use net-convert18:41
Odd_BlokeTrivial!18:44
rharperwe already have that18:47
rharpersmoser: Odd_Bloke:  net-convert  has a json input18:47
rharperwhich is effectively the openstack format18:48
rharper--kind json18:48
blackboxswok copr build for CentOS7 is updated for the cloud-init version which is currently undergoing SRU validation in ubuntu: 19.2.~385 https://copr.fedorainfracloud.org/coprs/g/cloud-init/el-testing/18:50
smoserthats input18:50
smoserhe needed output18:50
rharper?18:51
rharperah, right18:51
rharperI have input (aka output) that includes bonds and macs like Ironic18:51
rharperbut even that's more complicated than just verifying that net.get_interfaces() skips bonds18:51
Odd_BlokeYep, I'll proceed with this.19:00
blackboxswrharper: are we waiting on bionic and disco for https://github.com/cloud-init/ubuntu-sru/pull/45/files?19:52
rharperugh, right19:52
rharperlemme do that19:52
rharperblackboxsw: thanks19:53
blackboxswno worries19:53
blackboxswpending cloud-init SRU 19.2.24 publish isn't until Tuesday next week anyway. so still time :)19:53
rharperbut I had forgotten, so thanks19:54
Odd_BlokeOK, I have a test case, but it doesn't work on xenial because the bond never gets created because: /etc/network/if-pre-up.d/ifenslave: 37: /etc/network/if-pre-up.d/ifenslave: cannot create /sys/class/net/bonding_masters: Permission denied20:10
Odd_BlokeUgh, pretty sure this is a problem because I'm in a container; the owner is different outside of a container.20:23
rharpermodprobe bonding IIRC20:35
rharperon the host20:35
rharperIIRC20:35
rharperOdd_Bloke: ^20:35
rharpercontainer bonding is PITA20:36
Odd_BlokeNah, it doesn't work even in a privileged container with the module loaded; "read-only filesystem".20:38
Odd_BlokeI think I'm going to need to do the xenial test in a VM.20:38
Odd_BlokeWhich is fine, because we've established that using NoCloud is fine.20:38
rharperhttps://github.com/cloud-init/ubuntu-sru/pull/4521:49
rharperblackboxsw: updated21:49

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