How can I get a chef to reload node and take the recipe from where it left off?

I am trying to set up an asterisk server with a chef using Berkshelf and Vagrant, and first would like to update the kernel by running

apt-get upgrade

and reboot my machine.

How can I cause a reboot in the recipe and make it climb after rebooting the computer? I have no problem with this using Fabric, but

perform a "reboot"

Vagrant's Chef Provider Dies When Machine Reboots

+4
source share
1 answer

Idempotence is one of the principles of the chef.

This means that your recipe can be repeated over and over again, and it will only change things that are not expected.

So, in your case, it will look like this:

  • First Chef launches notifications that an unexpected kernel has been installed. Thus, the kernel is installed and a reboot is started.
  • Chef starts again, indicates that the kernel is installed as expected, and thus simply continues. Now you can continue other things.

One note: I have never tried this, but a reboot alarm in the middle of a cook's run can cause some damage. I would recommend interrupting the chef after the reboot signal (for example, by raising an exception, see How do you interrupt / terminate the chef? ).

+1
source

Source: https://habr.com/ru/post/1468887/


All Articles