Reputation: 15996
I'm trying to set up an asterisk server with chef using Berkshelf and Vagrant, and I'd first like to upgrade the kernel by running
apt-get upgrade
, and rebooting my machine.
How can I trigger a reboot in the recipe, and have it pick up after the machine reboots? I have no problem with this using Fabric, but
execute "reboot"
the Chef provisioner in Vagrant died as the machine rebooted
Upvotes: 4
Views: 2897
Reputation: 37580
Idempotence is one of the principles of Chef.
This means that your recipe can run over and over again, and it will only change things that are not as expected.
So in your case it would look like this:
One note: I've never tried this, but signalling a reboot
in the middle of a Chef run could do some damage. I'd recommend to abort the chef run after the reboot
signal (e.g. through raising an Exception, see How do you abort/end a Chef run?).
Upvotes: 1