Book Image

Chef Infrastructure Automation Cookbook

By : Matthias Marschall
Book Image

Chef Infrastructure Automation Cookbook

By: Matthias Marschall

Overview of this book

Table of Contents (14 chapters)
Chef Infrastructure Automation Cookbook Second Edition
About the Author
About the Reviewers

Creating custom knife plugins

Knife, the command-line client for the Chef server, has a plugin system. This plugin system enables us to extend the functionality of knife in any way we need it. The knife-ec2 plugin is a common example; it adds commands such as ec2 server create to knife.

In this section, we will create a very basic custom knife plugin to learn about all the required building blocks of knife plugins. As knife plugins are pure Ruby programs, which can use any external libraries, there are no limits for what you can make knife do. This freedom enables you to build your whole DevOps workflow on knife, if you want to.

Now, let's teach knife how to tweet your name!

Getting ready

Make sure you have a Twitter user account and created an application with Twitter (

While creating your Twitter application, you should set the OAuth access level to Read and write, so as to enable your application to post your name.

Create an access token by connecting the...