[ubuntu-cloud] Can I reboot from cloud-init?
Dave Hein
dhein at acm.org
Tue Sep 25 09:36:04 UTC 2012
On Mon, Sep 24, 2012 at 7:50 AM, Scott Moser <smoser at ubuntu.com> wrote:
> On Mon, 24 Sep 2012, Nick Barcet wrote:
>
> > On 09/23/2012 04:50 PM, Dave Hein wrote:
> > > I'm trying to setup a cloud-config file to invoke a script that will
> run
> > > apt-get to update packages and install a few additional packages.
> > > Because the kernel can be updated by the 'apt-get upgrade', I want to
> > > reboot at the end to activate the new kernel.
>
> This isn't *really* well tested, but one of our kernel developers
> basically wanted to do exactly what you were requesting.
> Under bug 1038108 (http://pad.lv/1038108) I added a cloud-config syntax
> for doing explicitly this.
>
> The config snippet, will do what you'd want in 12.10 and later. It
> reboots immediately after 'apt-get upgrade' by cloud-init if there is a
> reboot required. This also allows you to install new packages and make
> sure that by the time your user-data scripts run, you're in the right
> kernel and modules for that kernel too.
>
> #cloud-config
> apt_upgrade: True
> apt_reboot_if_required: True
>
> cloud-init is still a bit annoying in the logs to the console when this
> runs (as it's logging is going to rsyslog, and both cloud-init and rsyslog
> get killed by 'reboot'), but it generally works, and anything that was
> going to run after the 'apt_update_upgrade' config module will just run
> after reboot.
>
>
This is really nice and seems to work almost exactly as I would want.
However, the lack of persistent logs is a big roadblock.
I'm trying to think of a way to attach a very small EBS volume and direct
or copy the logs there (before the reboot). I have a vague notion of how to
make that work when launching a single instance, but it seems difficult to
do when launching multiple instances in one EC2 request.
Or perhaps it would be possible to e-mail the logs before the reboot, or
write them to S3, or post them to a web service?
--
Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-cloud/attachments/20120925/64fb5119/attachment.html>
More information about the Ubuntu-cloud
mailing list