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

socket-Hey all, any idea why my cloud-init config is not creating the ssh_host keys for me in this CFT? https://imgur.com/a/5t86kS705:06
socket-instead it does the normal random generation at the start up... Generating public/private ecdsa key pair. Your identification has been saved in /etc/ssh/ssh_host_ecdsa_key. Your public key has been saved in /etc/ssh/ssh_host_ecdsa_key.pub. The key fingerprint is: SHA256:sILmAwj+6f1qIJTvw0R1QGegrX75uY+q9bc5yLIniRI root@ip-10-0-1-12905:07
socket-https://apaste.info/X8x005:09
=== juergh_ is now known as juergh
rharpersocket-: the cc_ssh module will write host keys if you provide them in user data,   you'll need to lay out your config, like so https://cloudinit.readthedocs.io/en/latest/topics/modules.html#host-keys12:44
rharpersocket-: if are are including the host keys in the expected form and it's not writing them out, please file a bug and include the tarball output from cloud-init collect-logs12:45
socket-Hmm, so i think the problem is that I am trying to use cloud-init code in 'AWS::CloudFormation::Init:'. I think i need to figure out where is this AMI the cloud-init cofig is stored and add the ssh stuff there16:50
socket-AWS::CloudFormation::Init only supports packages, groups, users, sources, files, commands and services16:51
rharperhuh16:56
socket-im saying cloud-init is different from cloudformation init.  I thought one just called the other, but it only has a subset of the commands17:09
socket-So it looks like I can pass a cloud-config in the EC2 instances userdata like you said.  I currently have shell code being passed to the user data. Do you know if they can be mixed, or if i have to change all the shell code to be cloud-config runcmds?17:11
socket-rharper: do you know if i can do something like this? https://apaste.info/EteD17:18
Odd_Blokesocket-: You would either need to convert your shell script to a runcmd stanza (which can be strings, so that's not impossible by any means), or you'd need to look at multipart MIME user-data.  (Let me look up references for those options now.)17:43
Odd_Blokeruncmd documentation is https://cloudinit.readthedocs.io/en/latest/topics/modules.html#runcmd, MIME multipart is https://cloudinit.readthedocs.io/en/latest/topics/format.html#mime-multi-part-archive.17:44
rharperOdd_Bloke: socket-  cloud-init/tools/make-mime.py is quite useful here for constructing a multi-part mime18:02
Odd_Blokerharper: Hmm, seems like we should probably point to that instead of the inline helper script.18:05
Odd_BlokeI'll fix that now.18:10
socket-so iv learned some more. AWS user data allows only one content type. You can make this content type be multipart/mixed though.  So iv been testing out a simple mix https://apaste.info/c4HT18:28
socket-I havent got it working yet, but so far i can confirm that cloud-init-output says it ran the final_modules, and also the shell code at the bottom was run, and the file was created18:29
socket-but none of the packages are being installed, its like cloud-init is skipping that section18:29
Odd_Blokesocket-: Can you pastebin what your latest config looks like?18:31
socket-Odd_Bloke: lol thanks just saw your message18:31
socket-https://apaste.info/c4HT18:31
socket-thats what im sending to aws userdata18:32
socket-https://apaste.info/WtST18:33
socket-^ is the cloud-config.txt attachment aws uploads18:34
Odd_Blokesocket-: What does `cloud-init query -a` give you?18:36
socket-lots of meta data about the instance18:37
socket-do you wanna see the whole thing?18:37
socket-Odd_Bloke: https://apaste.info/GYGV18:38
socket-i removed the crypto but the rest is intact18:39
Odd_BlokeOK, I was hoping that would display the user-data after we'd unpacked it, so that didn't help. :p18:41
Odd_Blokesocket-: Do you have any WARN lines in /var/log/cloud-init.log?18:41
socket-i think it just writes 2 files to disk, the cloud-init.txt and userdata.txt18:42
socket-so i have access to both of those18:42
socket-checking18:45
socket-nothing for grep -i warn /var/log/cloud-init.log18:46
socket-Odd_Bloke: if i take out cloud_final_modules ... then it installs the packages defined18:51
socket-but it doesn't run the shell script18:51
Odd_Blokesocket-: Could you try using make-mime.py to create your input file?  That b64 encodes stuff, which might work if there's something strange about the input that's breaking things?19:17
socket-havent tried that yet, but in my latest test I noticed..19:25
socket-2020-04-28 19:22:20,990 - __init__.py[WARNING]: Unhandled unknown content-type (text/plain) userdata: 'b'MIME-Version: 1.0'...'19:25
socket-when using https://apaste.info/Ji5n19:26
socket- python mime.py -a user.txt ... ValueError: not enough values to unpack (expected 2, got 1)19:31
socket-whats the syntax19:31
Odd_Blokesocket-: filename:mimetype (where mimetype will be cloud-config for one and x-shellscript for the other)20:43
Odd_BlokeSomething like `./tools/make-mime.py -a config.yaml:cloud-config -a script.sh:x-shellscript`20:43
Odd_Blokeblackboxsw: Would really appreciate your review on https://github.com/canonical/cloud-init/pull/335, I put that together in the background while I was lurking in that meeting earlier.21:14
Odd_Bloke(Obviously has a couple of TODOs, but would like to know how that looks as a technical schema as far as you're concerned.)21:14
Odd_Bloke(And I'd like to know what testing you generally do, too. :)21:15
blackboxswwill do Odd_Bloke21:23
blackboxswhaha nice Odd_Bloke21:26
blackboxswI thought I heard a bit of typing then :)21:26
blackboxswOdd_Bloke: rharper rick_h just drew up an initial spec for review for cloud-init a json schema artifact21:26
rharperblackboxsw: nice21:32
blackboxswOdd_Bloke: couple of minor comments on https://github.com/canonical/cloud-init/pull/335/files21:40
blackboxswrharper: Odd_Bloke I think we have to think a bit about how we handle values that come in from /etc/cloud/cloud.cfg https://github.com/canonical/cloud-init/pull/335/files#r41694058221:41
rharperblackboxsw: I don't think so, args is not set via user-data , no ?21:51
rharperif you wrote your own etc/cloud/cloud.cfg.d/XXX file *and* you override the modules_stage list, *and* you pass args on that21:51
blackboxswrharper: I think args is only set via /etc/cloud/cloud.cfg.d/XXX by overriding the modules_list and providing - <config_name> <frequency>   <n-args>21:55
rharperright21:57
rharperyou can provide user-data that overrides the list, but it's really awkward to use21:57
rharperI'd rather log deprecated and avoid exposing it more21:57
blackboxswyeah it feels gross/wrong.22:00
blackboxswand undocumented22:00
blackboxswrharper: Odd_Bloke here's the undocumented image-based module config  I was talking about https://pastebin.ubuntu.com/p/qjkVYVq5Vg/22:35
blackboxswprovide a list for the config module and you'd have to know the specifics of how that module reacts to additional args22:35
blackboxswso yeah we can chalk up an item to deprecate that22:36

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