/srv/irclogs.ubuntu.com/2015/07/23/#cloud-init.txt

=== natorious is now known as zz_natorious
patcablequestion -- if I want to start a particular service before cloud-init in upstart, is there one good service to pick for that purpose?01:57
patcablethere's lots of options. should I just or them all?01:57
Odd_Blokepatcable: cloud-init-local should do the trick, I think.07:34
NerdyBikerHey guys, getting an issue when using the cloud-init stuff on EC2, finding that the user running the script doens't have knowledge of their HOME dir... not sure if that's expected or I'm missing somehting.08:39
Odd_BlokeNerdyBiker: cloud-init has a few different ways of running a script; could you paste the user-data you're passing?08:46
NerdyBikerI'll get it now. The main bit is a chef run and that's the bit failing. somewhere in that process it requires the "HOME" environment varibale but that gets output as blank.08:48
Odd_Blokechef itself requires it, or your chef recipes?08:51
Odd_BlokeNerdyBiker: (A copy of the error you're seeing would be good too :)08:51
NerdyBikerOdd_Bloke one of the chef recipes requires the HOME to be set, here's a gist with the parts and brief explaination that should help https://gist.github.com/MattDevUK/7d4a7a52775a3070671908:56
Odd_BlokeNerdyBiker: So my first reaction is that this is a bug in your Chef scripts rather than in cloud-init; but that might just be because then I don't have to do anything to fix it. ;)08:59
NerdyBikerOdd_Bloke that might be the case, but this is the first time using cloud-init but that recipe is used on fresh boxes using the same AMI as this machine all the time. the echo at the beginning of the user-data outputs "home is set to ''" :(09:01
Odd_BlokeNerdyBiker: I'm not especially familiar with this part of cloud-init, let me have a dig through the source and see what I find. :)09:02
NerdyBikerit works fine if you log into the machine manually and run the chef-client. but then I'd expect if it was a cloud-init issue, it would've cropped up all the time before as I'd expect a lot of people to require the HOME dir when performing script sons tart up :P09:03
NerdyBikerscripts on startup*09:03
Odd_BlokeNerdyBiker: So it looks to me like cloud-init just runs scripts with the environment that it starts in itself.09:05
Odd_BlokeNerdyBiker: So the problem you're hitting is that (upstart|systemd|...) doesn't set HOME in the environment of things that it runs.09:05
Odd_Blokes/problem/problem I think/09:05
Odd_BlokeNerdyBiker: See http://askubuntu.com/a/394330/141343 for a bit more info.09:06
NerdyBikerOdd_Bloke so it seems the issue is the user that executes the cloud-init hasn't tehcnically "Logged in" so their home would not be set? If I'm reading that right09:08
Odd_BlokeNerdyBiker: Yep, precisely.09:08
Odd_BlokeNerdyBiker: So I think you'll have to set HOME yourself; changing cloud-init to set it is probably opening a bag of worms.09:09
Odd_BlokeOr perhaps I mean a bag of bugs. :p09:09
NerdyBikerOdd_Bloke That's as I thought. so either we code around that, or possibly ask the aws guys how/why it's not being logged in properly.09:10
NerdyBiker:P09:10
Odd_BlokeNerdyBiker: It shouldn't be logged-in; it's run at startup by the init system.09:10
NerdyBikerAh yes,09:10
Odd_Bloke(I assume; obviously I don't know what AMI you're using :p)09:11
NerdyBikeryeah that sounds right, I thought it did some from of log in tuil I asked in ##aws today and they said it's just a stratup script that pulls the user-data in.09:11
NerdyBikerAh well, we'll work around it then :D Thank you for your help.09:12
Odd_BlokeNo worries, happy to help.09:12
Odd_BlokeNerdyBiker: It is worth noting that you might be able to do what you want with the more complex form of user-data.09:13
NerdyBikerOdd_Bloke oh? I'm listening :D09:13
Odd_BlokeNerdyBiker: So I don't know a great deal about the Chef side of it, but http://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/view/head:/doc/examples/cloud-config-chef.txt is an example user-data which does cheffy things.09:15
NerdyBikerOdd_Bloke new to cloud-init so not familair with it all yet, will take a look. Thanks!09:16
Odd_BlokeNerdyBiker: And a bit more info at http://cloudinit.readthedocs.org/en/latest/topics/modules.html#chef09:16
NerdyBikerOdd_Bloke Ah, saw the first one before, but thought it was a config file due to the yaml. Didn't realise I could pass a yaml file as user-data.09:18
Odd_BlokeNerdyBiker: Yeah, the key is the #cloud-config at the start; that tells cloud-init to process it as config rather than a shell script.09:21
Odd_BlokeYou can also do multi-part data, which would allow you to do the YAML config for some stuff and still pass in a script to be executed.09:21
NerdyBikerOdd_Bloke Awesome, think I've got enough to go on from now, you've been super helpful :D09:24
Odd_Bloke:)09:33
NerdyBikerOdd_Bloke looking at the cc_chef module, would you know if it's possible to define which version of Chef to install? I can't seem to find anything referencing a version number anywhere09:50
NerdyBikerwell, apart from the gem method09:51
Odd_BlokeNerdyBiker: I don't think it is; which method were you looking to use?09:53
NerdyBikeromnibus ideally09:53
Odd_BlokeNerdyBiker: https://bugs.launchpad.net/cloud-init/+bug/146269309:55
NerdyBikerOdd_Bloke awesome :D Should've looked there first I guess09:57
Odd_BlokeNerdyBiker: That looks like it'd be fairly easy to fix, if you wanted to have a go. ;)09:59
NerdyBikerOdd_Bloke Would be a way to get my head around how some it works and stop asking silly questions for sure. :P10:04
Odd_BlokeNerdyBiker: You haven't asked a single silly question thus far!10:06
NerdyBikerOdd_Bloke that's good10:16
patcableOdd_Bloke: hmm, thanks. I did try to stick it before cloud-init-local but something else was going on. I may need to make sure I have the same start condition (I started on filesystem and cloud-init-local starting, but maybe i need to do runlevel & cloud-init-local)11:25
Odd_Blokepatcable: My head is too much in systemd-land for me to be much more help.11:26
Odd_Blokepatcable: smoser might be able to help you out, he's good like that.11:26
patcableOdd_Bloke: that makes sense; a demo of something I'm doing is using 14.10 right now. just bumping from upstart to systemd at least wont be as bad11:27
Odd_Blokepatcable: Utopic's EOL is today (https://wiki.ubuntu.com/Releases), so that's probably worth doing. :p11:28
patcableha11:28
patcablewe basically wrote a way to send encrypted data to cloud init so you could put private data into a user script, but it relies on a key being present somewhere before cloud-init is invoked11:28
Odd_BlokeOh, cool.11:30
Odd_Blokepatcable: So how do you get the key?11:31
NerdyBikerOdd_Bloke just to let you know, changed our user-data to use the cc_chef module, its cleaner but still stops at the same spot with the HOME dir, so going to have to manually set that variable as thought before :P11:31
Odd_BlokeNerdyBiker: Great!  (Except for the HOME bit :p)11:32
patcableOdd_Bloke: it's complicated. there's a process that is able to pull half the key from a verifier (that ensures the state of a trusted platform module is a okay) and the other half from openstack. The crypto folk I work with have a much better explanation, heh13:01
Odd_Blokepatcable: Fair enough. :)13:04
smoserpatcable, running upstart 'start on starting cloud-init-local' should get you run before cloud-init's first job14:04
smoserbut you're basically guaranteed to not have network then14:04
smoserwhich is probably not what you want14:04
smoserstart on starting cloud-init14:05
smoserwould guarantee you network, and in ec2 is what actually does things (as there is no local datasource for ec2, theirs requires metadta network accesss)14:05
patcableahh ok14:05
smoserand above, you're not "basically guaranteed", you shoudl be guaranteed to have no network.14:06
patcablegotcha14:06
patcablesmoser: though, we're using configdrive since we're in an openstack environment16:03
patcablesmoser: so I imagine we could still do what we want before cloud-init starts, though we'd have to work through the details later if we're going to port this to an EC2 like environment16:03
=== zz_natorious is now known as natorious
=== natorious is now known as zz_natorious

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