Chapter 9. Waking the Chef

In Chapter 7, we showed how to use Chef to install and configure MCollective. In this chapter, we’re going to show how MCollective can:

  • Use the Chef recipes and roles applied to the node in filters

  • Use Ohai data as facts for MCollective filters

  • Query, start, stop, and restart the Chef client

  • Wake the Chef client to evaluate the node immediately

To control the Chef daemon, you’ll need to upload the chef-client cookbook and its dependencies. I did it like this:

~$ cd chef_repo/cookbooks
cookbooks$ knife cookbook site download chef-client
Downloading chef-client from the cookbooks site at version 3.6.0
  to /home/jorhett/chef-repo/cookbooks/chef-client-3.6.0.tar.gz
Cookbook saved: /home/jorhett/chef-repo/cookbooks/chef-client-3.6.0.tar.gz
cookbooks$ knife cookbook site download cron
Downloading cron from the cookbooks site at version 1.4.0
  to /home/jorhett/chef-repo/cookbooks/cron-1.4.0.tar.gz
Cookbook saved: /home/jorhett/chef-repo/cookbooks/cron-1.4.0.tar.gz
cookbooks$ knife cookbook site download logrotate
Downloading logrotate from the cookbooks site at version 1.6.0
  to /home/jorhett/chef-repo/cookbooks/logrotate-1.6.0.tar.gz
Cookbook saved: /home/jorhett/chef-repo/cookbooks/logrotate-1.6.0.tar.gz
cookbooks$ tar xzf chef-client-3.6.0.tar.gz
cookbooks$ tar xzf cron-1.4.0.tar.gz
cookbooks$ tar xzf logrotate-1.6.0.tar.gz
cookbooks$ knife cookbook upload chef-client cron logrotate Uploading chef-client [3.6.0] Uploading cron [1.4.0] Uploading logrotate ...

Get Learning MCollective now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.