Creating custom handlers

Chef handlers can be very helpful to integrate Chef with your tool chain. If there is no handler readily available for the tools you are using, it's pretty simple to write your own.

We'll have a look at how to create an exception handler, reporting Chef client run failures to Flowdock, a web-based team inbox and chat tool.

Getting ready...

As we want to publish information to a Flowdock inbox, you need to sign up for an account at http://www.flowdock.com. Also, we need to install the API client as a Ruby gem in order to be able to post to our team inbox from Chef.

Install the flowdock gem on your local development box:

mma@laptop:~/chef-repo $ chef gem install flowdock
...TRUNCATED OUTPUT... Fetching: flowdock-0.5.0.gem (100%) ...

Get Chef: Powerful Infrastructure Automation 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.