1.

What are the various ways in which we can apply an updated cookbook on the Chef node?

Answer»

Whenever a cookbook is modified, the new version details of the cookbook is UPDATED in “metadata.rb” file and then UPLOADED to Chef Server using knife upload or berkshelf upload. There are 3 ways in which the new cookbook would be applied to the desired Chef nodes.

  • We can run chef-client with latest cookbooks from Chef Server on all nodes or SPECIFIC nodes using “knife ssh” command. For EG:
    knife ssh '*:*' 'sudo chef-client'
  • SSH into the respective node where you want to run the latest cookbook and run the chef-client .chef-client picks up the latest cookbook in the Chef Server unless otherwise specified as a cookbook restriction says for eg: in an environment.
  • chef-client could be run as a daemon or service at a specified time. Chef Infra Client cookbook available in GitHub repository could be used for this purpose.chef-client with “USR1” option could be used to trigger chef-client and do the node convergence. Apart from making a chef-client run, a service we can utilise Cronjob to run it often.


Discussion

No Comment Found