/srv/irclogs.ubuntu.com/2018/06/25/#cloud-init.txt

agentnoelHi there, I'm looking to run some scripts per-instance, and pass them environment variables via user-data.00:12
agentnoelThis is in the context of AWS EC200:12
agentnoelI've found boothooks can set environment variables early in the process, but the syntax is not completely user friendly. If I supply a "bash script" as user data, it is easier to read, but executes too late in the process.00:14
agentnoelDo you have any suggestions for injecting environment variables early in the cloud-init process?00:14
agentnoelAlso, the scripts are "baked" into the Amazon Machine Image at /var/lib/cloud/scripts/per-instance/. Is this the correct location? (I couldn't get the vendor scripts folder working).00:15
agentnoelThank you :-)00:15
blackboxswrharper: so, would you expect if cloud-init didn't rename interfaces that we'd avoid the wait-online  timeout?17:54
rharperblackboxsw: well, I would say no, but I also don't know why we're not matching any interface to configure either18:35
blackboxswrharper: I'm wondering if the dual rename is introducing a race in networkd wait-online. like the data gets cached at some point post cold-plug rename and pre cloud-init rename18:37
rharperno, rename happens before networkd starts18:37
rharperit's 1) boot 2) generate which creates /run/systemd/network/*.{link,network} files 3) cold-plug (which fires on .link files) 4) cloud-init local18:37
smoserrharper: i dont think order of 2 and 3 is guaranteed18:38
rharperyes18:38
rharperit is18:38
rharpersystemd generators run way before any units are processed18:38
smoser? cloud-init's invocation of generate ?18:38
rharperno18:38
rharpergenerators18:38
rharpernetplan get's called as a geneator by systemd itself18:39
rharperthis is reboot, so we already have an existing /etc/netplan/*.yaml file18:39
smoserah. yeah.18:39
blackboxswas it stands operations like look the following:   cold-plug rename eth1 -> rename3 because of our existing /run/systemd/networkd/10-netplan-eth0.link file which contains a Name=eth0 and matching mac. But since azure presents an existing eth0 we fallback to rename3.18:40
blackboxswthen cloud-init does two  renames, eth0 -> cirename0 and rename3 -> eth0;18:41
rharperoh, interesting18:41
rharpermoves the "new" eth0 out of the way; and then pushes the right eth0 into position18:41
blackboxswyeah cloud-init's is a little smarter, move the existing out of the way18:41
rharperso, this sounds just fine18:41
rharperw.r.t getting the "right" eth0 in place18:41
rharperwhich means it won't be optional18:41
rharperwe'll wait for it and config matches;  so why the stall then on wait-online ?18:42
blackboxswright, but networkd-wait-online may have been waiting for the orig eth0 device to come online (by what logic I'm uncertain). if new rename3 ->eth0 is moved into eth0 place prior to a udev rule saying online maybe that's why we timeout?18:42
rharpernetworkd-wait-online can't run until cloud-init-local has finished, we block the network.target18:43
blackboxswhrm ok... <drums-fingers-on-desk>18:43
blackboxswbtw, order of the nics is properly rendered by azure metatdata, I can see the ips and macs get pushed to the proper index in the 'network-'-18:48
blackboxsw> 'interface' key18:48
rharperblackboxsw: so I don't know how much we can play with it and look at the console but if possible, getting a networkctl status --all dump prior to invoking systemd-networkd-wait-online;  I'd typically do this with an extra ExecStart=/bin/sh -x -c 'cmd1 here' in the networkd.service file18:50
rharperthe alternative is to recreate in say qemu where we can manually swap the mac addrs on the underying nics to trigger the scenario and still have a serial console to get in and debug18:51

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