/srv/irclogs.ubuntu.com/2014/03/27/#cloud-init.txt

=== evilissimo is now known as Guest15530
=== harlowja is now known as harlowja_away
=== harlowja_away is now known as harlowja
=== harlowja is now known as harlowja_away
=== Guest15530 is now known as evilissimo
cjdc_Hello all10:35
cjdc_quick question: in cloud config's write_file userdata10:35
cjdc_how do i put a new line in the content?10:36
smosercjdc_, there are a lot of ways to do it.12:47
smoserits yaml formated.12:48
cjdc_| should be enoughj right?12:48
cjdc_maybe the issues I am having is with escape characters12:48
smosercjdc_, http://paste.ubuntu.com/7162529/12:51
smoseroops. the thing at line 15 was wrong.... i actually hadn't updated /tmp/foo to what it shows.12:54
smoserhttp://paste.ubuntu.com/7162554/12:54
smoserso in short, the guaranteed-works answer is to just use yaml.dump12:55
smoseryou can also use json if you prefer12:55
smoseryaml is pure superset of json12:55
sayalilunkadHello everyone, I am trying to write a cloud init pliugin to load the contents of a file. But I am not very familiar with the code base for cloud init. Could someone guide me a bit here12:56
smosercjdc_, theres an example of dumping json.12:57
smoserhttp://paste.ubuntu.com/7162563/12:57
cjdc_smoser: I am trying that right now. thanks12:58
smoseryou can also base64 encode stuff.12:59
smoseror use the '!!binary'12:59
smosersayalilunkad, "loads the contents of a file" ?13:02
smoserthe two "plugin" ways to do something new in cloud-init are "config-modules" and "part-handler"13:04
sayalilunkadsmoser: Yes, loading data from a file 13:04
smoseradditionally, if what you need to do is just run stuff on boot, you can lay down scripts in certain directories and they'll run.13:05
smoserthats less "plugin".13:05
sayalilunkadsmoser: Actually I am applying to an organization had given me this problem statement 13:06
sayalilunkadWrite a Cloud-Init plug-in to load data from a file was the exact exercise to do13:07
smoserwell, if you just said that, i'd think that "config module" would probably be the right thing.13:08
smoserthose are in cloudinit/config/cc_*13:09
smoserand then you enable them by adding them to one of the module lists in config/cloud.cfg13:09
sayalilunkadok so configuring a module can help with doing this?13:09
sayalilunkadsmoser: Since I am fairly new to this can you give me some links that would help13:13
sayalilunkadCurrently using this http://cloudinit.readthedocs.org/en/latest/topics/hacking.html13:13
smoserwell, you can definitly run 'open(some_path_to_file).read()' from a config module, whic would qualify as "loading data from a file" in some sense.13:14
smoserhttp://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/revision/79013:14
smoseris an example of adding a config module.13:14
sayalilunkadAlright, thanks. Will try it 13:15
smoserin that commit you can ignore the noise in util.py and cc_resizefs.py, as that was just moving a block of code from one place to a common place13:15
sayalilunkadsmoser: okay13:16
sayalilunkadsmoser: Also in my cloud-init/config I have only these two file cloud.cfg  cloud.cfg.d13:17
sayalilunkadis that ok?13:17
smoserthats expected, yes. look at the changes done in that diff, and make similar changes for what you want to accomplish.13:22
smoseri'm sorry, but I really dont' have time to help you much more than that.13:23
smoserdocumentation improvements are welcome of course.13:23
sayalilunkadsmoser: no problem! thanks a lot :)13:24
cjdc_smoser: it worked with dump!13:27
cjdc_thanks for the help13:27
mdormani'd like to have ssh not start until after clout-init has run (to install the ssh key), basically so that the user cannot even connect to ssh at all until the keys are installed.  is there a way to tell cloud-init to start ssh after configuring the keys?16:21
=== harlowja_away is now known as harlowja
=== alexpilotti_ is now known as alexpilotti
smosermdorman, cloud-init doesnt start ssh18:06
smoseron ubuntu ssh starts normally.18:06
smoseryour request makes sense though.18:06
smoserto do it you'd have to modify the ssh job.18:07
pquernahttps://gist.github.com/pquerna/491a3487951131f35f8f <- example of an.. upcoming openstack ironic interfaces file that'll get dropped into configdrive (still needs some tweaks).  ubuntu/deb should be fine, but will try to make the patches to get it working on rhel/etc in the next few weeks18:08
=== harlowja is now known as harlowja_away
=== harlowja_away is now known as harlowja
mdormansmoser:  yep, got it.  makes sense.  it does _restart_ ssh as part of the set-password module, but not totally what i want.  i'll figure something out.20:40
smoserright. it only restarts if it changes the config20:49
smoserbecause it has to.20:49
mdormanyeah.20:53
smosermdorman, is this ubuntu ?20:57
mdormannope, centos21:07
=== alexpilotti_ is now known as alexpilotti
smosermdorman, it migh tbe possible to run something as a boothook that stopped ssh from starting.23:21
smoseri tihnk that'd be possible on ubuntu.23:21
smoserbut i dont know the centos jobs well enough23:21
mdormanyeah i was able to figure out a different solution23:24
smoserwhat did you do ?23:24
mdormanfigured out that sysvinit wise, sshd was set to start after cloud-init23:26
mdormanso it should have just worked23:26
mdormanhowever, we use power broker to do auth on our linux machines to AD, and the bootstrap for that (which starts earlier) was actually starting ssh on its own23:27
mdormanso just needed to turn that piece off, so that it started in the correct order according to stock init scripts23:27
mdormanthanks for the help.  gotta run23:31

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