Book Image

Chef Infrastructure Automation Cookbook Second Edition

By : Matthias Marschall
Book Image

Chef Infrastructure Automation Cookbook Second Edition

By: Matthias Marschall

Overview of this book

Table of Contents (14 chapters)
Chef Infrastructure Automation Cookbook Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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%)
Successfully installed flowdock-0.5.0
2 gems installed

How to do it...

Carry out the following steps to create a custom handler to post Chef run failures to Flowdock:

  1. Create your handler class:

    mma@laptop:~/work/chef-handler-flowdock $ mkdir -p lib...