/srv/irclogs.ubuntu.com/2020/04/13/#cloud-init.txt

mutantturkeyhello13:16
mutantturkeyis there a flag for cloud-init to only use specific modules?13:16
mutantturkeyright now i am playing whack-a-mole with cloud-init to prevent it from overwriting my various configs. However, I basically just need cloud-init's networking module.13:17
mutantturkeyor maybe the answer is 'provide my own cloud-init config'13:19
mutantturkeythat just imports one module13:19
mutantturkeybecause mine right now is the stock one from digital ocean13:19
Odd_Blokemutantturkey: You can configure which modules cloud-init will execute by modifying /etc/cloud/cloud.cfg, but you can't do that after first boot (because that's too late, of course) so that would involve image modifications.  What is cloud-init doing that you would like to disable?  (There may be user-data you can pass to disable the particular undesirable behaviours you're seeing.)13:36
rick_h37279514:07
Odd_BlokeTime to get a new phone.14:08
rick_hpretty much14:08
rick_hor yubikey14:08
rick_hoops14:08
Odd_Bloke:p14:08
blackboxswOdd_Bloke: rharper. so branching strategy for cloud-init ubuntu/daily/<series>  vs ubuntu/<series>  do we want to talk about concerns with the approach mentioned here https://hackmd.io/VbmtcZLyR4650aqqmfMMYg   or https://github.com/CanonicalLtd/uss-tableflip/pull/45 ?15:34
blackboxswIt may be faster to chat about that in a virtual hangout to make sure we aren't exposed to gaps. but, generally it feels like PR #45  simplifies our cherry-pick process a bit15:37
Odd_Blokeblackboxsw: Which is currently the canonical source of the proposed process?15:37
blackboxswOdd_Bloke: https://github.com/CanonicalLtd/uss-tableflip/pull/45/files#diff-d6b5a9d4866846cffb4df4461090dfbb15:38
Odd_BlokeOK, so I think we can discard the HackMD entirely then?15:39
blackboxswOdd_Bloke: yes, we can. As I think the use-cases I mentioned there are handled by the proposal in PR #4515:40
Odd_BlokeOK, cool.15:41
blackboxswI think the biggest set of open conversation on it was here https://github.com/CanonicalLtd/uss-tableflip/pull/45#discussion_r40650531615:44
blackboxsws/conversation/questions/15:44
rharperOdd_Bloke:  blackboxsw: I have time now, meet in standup ?15:59
blackboxswsure I can swing on by15:59
Odd_BlokeOops, was AFK, OMW.16:06
mutantturkeyOdd_Bloke: well, I do use a custom image16:44
mutantturkeythat's so i can put things on like, users keys, and custom packages, its an entire dev environment in a single VM for my work stack, so it has lots of stuff on it16:45
mutantturkeyOdd_Bloke: what module seems to generate the files under /etc/network/interfaces?16:45
blackboxswrharper: I think you are right, we can git cherry-pick && git revert single cpick commitish properly I misinterpreted the output from the CLI. the revert is valid and applicable. it was a PEBCAK issue on my side thursday.   https://paste.ubuntu.com/p/QnFnvJHMGx/16:57
blackboxswOdd_Bloke: rharper per the above paste. I think we can use individial git cherry-pick <cpick_commit_from_devel>; (daily-branch) git revert <cpick_commit_from_devel>;16:57
blackboxswso no full merge necessary each time we cherry pic.16:58
blackboxswI can update the doc on PR #45 now for the minimal approach16:58
rharperblackboxsw: even with changelog entries ?17:04
blackboxswrharper: that's without the changelog entries17:05
rharperchangelog is one file that could get in conflict17:05
rharperwith new commits to release that are not present in daily17:05
rharperso maybe replay your test but with changelog commits to release before the recipe build  step such that you're merging daily into a branch that has release + changelog commit not in daily;17:06
rharperand see if it blows up17:06
rharpermutantturkey: cloudinit/net/eni.py writes to /etc/network/interfaces.d/50-cloud-init.cfg     we don't touch /etc/network/interfaces file directly17:07
rharpermutantturkey: networking isn't a config module;  we don't yet have a "render-network-config" command cli that's does the right thing at this time (there are several places cloud-init looks for input for network-config);   but it has been requested on a few fronts;  I'll see about getting that on our next cycle features17:10
mutantturkeyrharper: so eni.py writes the config, cool. that config file is exactly what i want17:11
mutantturkeyrharper: if i remove everything elsefrom my /etc/cloud/cloud.cfg... will it still run eni.py and not the other modules?17:12
rharpermutantturkey: eni will run independent of the config modules17:13
mutantturkeyokay17:14
mutantturkeydoes anything else run independent of the config modules hten?17:14
mutantturkeythen?17:14
rharperit's part of cloud-init stages (cloud-init init --local stage runs network rendering code)17:14
mutantturkeymy goal: get DO to provide the correct network information, but that's it17:14
rharperDO as in digital ocean ?17:14
mutantturkeyyes exactly17:14
rharperhow is the information incorrect ?17:14
rharperthey provide network metadata IIRC17:14
mutantturkeythey provide exactly what i need yes. the /etc/network/interfaces.d/50-cloud-init.cfg works perfectly17:15
rharperoh, I see;  you only need network-config17:15
mutantturkeyhowever, other things are done by cloud init that overwrite my config17:15
mutantturkeyi think so :-)17:15
rharperyes; so if you make the init_modules and config modules and final modules lists empty; that should be rather sparse17:15
mutantturkeyis an empty /etc/cloud/cloud.cfg valid?17:16
rharperyes but likley won't do what you want17:16
mutantturkeyokay.17:16
mutantturkeyi know my goal, i am not quite sure how to make cloud-init do what i want17:17
rharperyou want:  cloud_init_modules: [] , cloud_config_modules: []  and cloud_final_modules: []17:17
rharperthis will tell cloud-init to not run any of the config modules17:17
mutantturkeyokay17:17
mutantturkeyso something lik17:17
mutantturkeyecho "cloud_init_modules: []" > /etc/cloud/cloud.cfg17:17
mutantturkeyecho "cloud_config_modules: []" >> /etc/cloud/cloud.cfg17:17
mutantturkeyecho "cloud_final_modules: []" >> /etc/cloud/cloud.cfg17:17
rharperI'm not sure what removing the system_info section will do17:18
rharperlikely break17:18
rharperI'd put your config you have in a different file that will get merged17:18
mutantturkeyokay, that would be in17:18
rharperso write that to /etc/cloud/cloud.cfg.d/99-disable-config-modules.cfg17:18
mutantturkey/etc/cloud/cloud.d/17:18
rharperyes17:18
mutantturkeygot it17:18
mutantturkeythanks let me try that17:18
rharpersure17:19
mutantturkey(not that i dislike cloud init, its very cool)17:19
mutantturkeyi just am only needing it for one thing17:19
rharperso what about resizing root and ssh host key clean/gen etc ?17:19
mutantturkeyhm17:20
mutantturkeygood point17:20
rharperso, keep growpart, resizefs17:20
rharperin cloud_init_modules17:20
mutantturkeyer how do i do multiline bash things17:20
rharperfor those;  and ssh if you want keygen17:20
mutantturkey<<<EOF17:20
rharpercat  > /myfile <<EOF17:20
rharper...17:21
rharper..17:21
rharperEOF17:21
mutantturkeyright17:21
mutantturkeydo the numbers mean anything? 99, 50 etc?17:21
mutantturkeyis it order of operation?17:21
rharperyes, order of merging17:21
rharperso 99 will *clobber* previous keys in the dictionary by default17:21
mutantturkeyunderstood17:22
rharperwhich is what you want in this case17:22
mutantturkeycloud_init_modules: [growpart, resizefs]17:22
mutantturkeyjust want to make sure that syntax is correct17:23
rharperalso, DO sends vendor-data which contains a lot of stuff, you may want to disable their vendor-data,  you can include "vendor_data: {enabled' False}"17:24
rharpermutantturkey: that looks right17:24
mutantturkeyvendor_data: {enabled: False}"17:24
mutantturkey?17:24
rharpermutantturkey: one thing you can do to test this out on existing instances is to write your config file out, and then: sudo cloud-init clean --logs;  then sudo cloud-init init --local;  sudo cloud-init init;  that runs the first two stages17:25
rharperthe platform can send additional cloud-config to your instance17:25
rharperyou don't have to accept it, but that turns it off17:25
rharperyou can check /var/lib/cloud/instance/vendor-data.txt to see if they sent you some;  ISTR DO had quite the bundle17:25
mutantturkeyrharper: could you review this quickly?17:27
mutantturkeyhttp://ix.io/2hTi17:27
rharpery17:27
rharperadd #cloud-config to the first line of your config file you generate17:28
mutantturkeyawesome, done.17:28
mutantturkeyalright, i shall report back in a bit with my results!17:32
blackboxswrharper: one thing I don't understand is why we would want to cherry-pick the debian/changelog commitish too into daily for a revert from u/daily/devel? Since the changelog entry also increments debian/changelog version as well, a revert will mean that when we merge back into ubuntu/devel, we'll be down-reving cloud-init as built during daily images.17:51
blackboxswso this would mean that every daily deb build would be 1 subrevision lower than the version present (and released) in ubuntu/devel.17:52
blackboxswmaking it a bit harder to install and test a daily build vs the current released version of cloud-init17:52
mutantturkeyrharper: cool, i borked it up (whitspace after EOF, but let me build and run it again).18:27
mutantturkeythe other problem i currently have is that it doesn't seem to apply the new network information after cloud-init puts the information on the first boot. after the first boot it works just finewith thecorrecet info18:28
mutantturkeythough i wonder if thats debian doing something different, need to look ta logs18:28
punkgeekI use this sample to config static ip on ubuntu 16.04 vm, But it doesn't work, https://paste.ubuntu.com/p/Hh8SkhkS9P/18:35
mutantturkeyrharper: yeet19:00
mutantturkeyNo 'config' modules to run under section 'cloud_config_modules'19:00
mutantturkeyNo 'final' modules to run under section 'cloud_final_modules'19:00
adrian27hello, I have the following in /etc/cloud/cloud.cfg.d/01_runcmd.cfg19:12
adrian27  runcmd:19:12
adrian27but it is not executed. Any idea what am I doing wrong?19:12
adrian27tanks19:12
sarnoldit looks like your paste may have been destroyed, better to use a pastebin site19:12
adrian27thanks19:12
adrian27its just those two lines19:13
sarnoldthat's the thing, we only got one: https://paste.ubuntu.com/p/n93Dk5pBFB/19:13
rharpermutantturkey: w.r.t network-config, we only write network-config once (per-instance)  ; if you're repeat testing on the same instance you want to use the cloud-init clean --logs (which wipes instance data and the log files)19:14
rharperblackboxsw: I don't *want* daily to be down level; I was just worried that we'd see conflicts due to release and daily both writing to debian/changelog19:15
adrian27he he, okay, here it is: https://paste.ubuntu.com/p/kRQMxmRBVf/19:15
sarnoldadrian27: try /usr/bin/echo or /bin/echo, depending upon where your echo executable is located19:16
sarnoldadrian27: (I have no idea if this'll help, but giving explicit paths to things often helps)19:16
blackboxswrharper: the way PR #45 is setup, we are only reverting the single commitish that introduced the debian/patches/cpick-* file. the changelog commit is separate, so if we don't cherry-pick it into ubuntu/daily/<series> then we essentially don't touch it, or risk merge conflicts. But we have the caveat of daily build recipe debian/changelog representing that a cherry-pick is applied, when it really isn't19:16
blackboxswBTW rharper Odd_Bloke I just force pushed all doc changes and script changes to use git revert instead of git merge ubuntu/devel -> ubuntu/daily/devel19:17
adrian27sarnold thanks, I will try that19:17
rharperblackboxsw: I see, so we don't conflict at all since we only revert the patch;   I'm not super worried about daily changelog19:17
blackboxswrharper: right, and I just double checked if we wanted to also revert the debian/changelog entries and yes it causes conflicts making it a far more manual process than we want :/19:18
adrian27sarnold: it still does not work :(19:19
sarnoldadrian27: dang :( sorry. how about a touch command to create a file, instead? maybe stdout isn't going where you expect?19:20
adrian27sarnold: hmm, good idea. Will be back19:21
adrian27sarnold: nope, still does not work :(19:25
sarnoldadrian27: dang, sorry, I'm out of ideas19:25
adrian27sarnold: thanks anyway :)19:26
adrian27do you need to have the #cloud-config at the beginning in config files from  /etc/cloud/cloud.cfg.d/ ?19:33
rharperadrian27: I don't think so but it can't hurt19:33
adrian27can I see somewhere if cloud-init tried to execute my runcmd commands?19:36
rharperadrian27: yes, cat /var/lib/cloud/instance/scripts/runcmd19:36
adrian27rharper: well, that folder its empty. What does that mean? That it did not even tried to execute commands in https://paste.ubuntu.com/p/kRQMxmRBVf/19:38
adrian27actually /var/lib/cloud/instance/scripts/ is empty19:38
rharperit's hard to say, cloud-init collect-logs will produce a tarball with debugging info;  the log file will show whether it ran into issues with your userdata or something else19:40
adrian27isn't that /var/log/cloud-init.log ?19:42
rharperhttps://paste.ubuntu.com/p/8zb2qMmYbF/19:43
rharperadrian27: it's more that just that, but take a look at that19:43
rharperI'm not sure how you're re-running your test on your config but 1)  user-data needs a #cloud-config at the top  2) config modules typically only run once per instance so if you are calling cloud-config.service etc; it's skipping over the runcmd module as it's already run  3)  you can test with cloud-init single --   see the paste for an example;   when you're have it working, you can cloud-init clean --logs --reboot and see a "clean boot" run19:45
sarnoldrharper: oh handy, thanks19:48
rharpersarnold: =)   -- yeah, we are in need of some cli refactor to make testing/validating config eaiser ;  we do have the schema subcommand but we've not completed writing schemas for all of the config modules19:50
rharperblackboxsw: ok; yeah so touching changelog on both branches means merge conflicts ... that was expected;  so are we OK then with the "downlevel" changelog entry?  you also mentioned that the daily PPA version would not be newer than what's in the archive?20:06
blackboxswrharper: as PR 45 currently the pkg version generated  will be identical for packages generate from (ubuntu/devel) and (ubuntu/devel with ubuntu/daily/devel merged into it)20:11
blackboxswbut the second merged case will have the cpick reverted (just no changelog dicc)20:11
blackboxswdiff*\20:11
Odd_BlokeI don't think the changelog is used in recipe builds.20:12
Odd_BlokeBecause the recipes generate their own version string20:12
blackboxswhahah, right20:12
blackboxswgood pt20:12
Odd_BlokeI thought of this at some point over the long weekend, forgot about it until just now. :p20:12
blackboxswright so it'll always be the  deb-version {latest-tag}-{revno}-g{git-commit}-0ubuntu1+{revno:ubuntu-pkg}~trunk20:12
blackboxswso, what would our preference be (that the unused debian/changelog in ubuntu/daily/devel contain an item that says "reverted" cpick? or is it a don't care (because we have a revert commit in the git log anyway20:13
rharperdon't care on daily build20:14
rharperthough maybe as Odd_Bloke pointed out, we'll suddenly find so many users really do look at daily ppa changelog ...20:14
rharperI'd defer tackling it20:14
blackboxswok, if we don't care there on daily build, I think #45 is in shape then, and only performs a single git  revert of the cpick file in the ubuntu/daily/devel branch.20:15
rharperfrom my POV daily ppa is a way to verify that some bug works;  that's almost always an integration type of test20:15
rharperblackboxsw: ok, let me re-review shell code20:15
rharperI assume you added all of the git command || clean-up  bits I requested ?20:16
adrian27rharper: thank you20:16
blackboxswrharper: I tried to mark resolved as I addressed each comment. I'll make sure I've pushed all those cleanup review comment resolutions20:17
rharperadrian27: all good?20:20
rharperblackboxsw: k20:20
blackboxswrharper: +1 on handling your review comments. I noticed a typo in one of doc my fixes and just pushed it now. 'a older series' instead of 'an older series'20:20
blackboxswthe others look resolved20:21
adrian27rharper: yes. you were right, rumcmd is run only once. I booted the instance, wrote the /etc/cloud/cloud.cfg.d/ file, and expected to see it running when rebooted20:21
adrian27why cloud-init does not have a man page? :)20:23
rharperadrian27: ok;  fair point on man page20:30
adrian27well, you guys are doing a great job with cloud-init20:32
powersjhttps://github.com/canonical/cloud-init/tree/master/doc/man20:34
rharperadrian27: thanks for the kind words ;  powersj tells me we should have a man page ... so double checking on that20:34
blackboxswrharper: powersj hah!20:34
blackboxswtime to bundle it in the deb package20:35
blackboxswor see where we reverted that20:35
blackboxswhah it *is* there on latest, and bundled20:35
Odd_Bloke`man cloud-init` doesn't work in my focal EC2 instance (launched last week).20:36
blackboxswcloud-init 19.3-68-gc78fddea introduced it20:36
powersjhttps://github.com/canonical/cloud-init/pull/10120:36
powersjso apparently that needs to happen somewhere else?20:37
blackboxswI have it on focal lxc images20:37
Odd_BlokeFrom the archive?20:38
Odd_BlokeBecause `man cloud-init` is failing in this container I just launched.20:39
rharperOdd_Bloke: me too20:42
rharperdaily focal lxd does not have man page20:42
blackboxswOdd_Bloke: /me relaunches. interesting. it was on 20.120:45
blackboxswand failed on latest current build20:45
blackboxsw20.1-10-g71af48df-0ubuntu3 for failed case... and my success case was locally built20:46
Odd_BlokeYeah, locally built will be fine.20:46
Odd_BlokeAssuming you did it from master.20:46
blackboxswyeah right ;/20:46
Odd_BlokeBecause that PR only updated the packaging used in master.20:46
blackboxsw+1. thanks for the bug adrian27 :)20:47
blackboxsw:q20:50
blackboxswwrong term :/20:50
blackboxswok addressed https://github.com/canonical/cloud-init/pull/152 comments rharper as well thanks for the schema review21:41
blackboxswahh and thanks for the review on uss-tableflip21:42
=== tds1 is now known as tds
Goneriblackboxsw, https://github.com/canonical/cloud-init/pull/298 :-)23:14

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