Book Image

Chef Cookbook - Third Edition

By : Matthias Marschall
Book Image

Chef Cookbook - Third Edition

By: Matthias Marschall

Overview of this book

Chef is a configuration management tool that lets you automate your more cumbersome IT infrastructure processes and control a large network of computers (and virtual machines) from one master server. This book will help you solve everyday problems with your IT infrastructure with Chef. It will start with recipes that show you how to effectively manage your infrastructure and solve problems with users, applications, and automation. You will then come across a new testing framework, InSpec, to test any node in your infrastructure. Further on, you will learn to customize plugins and write cross-platform cookbooks depending on the platform. You will also install packages from a third-party repository and learn how to manage users and applications. Toward the end, you will build high-availability services and explore what Habitat is and how you can implement it.
Table of Contents (15 chapters)
Chef Cookbook - Third Edition
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
Index

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. 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 that can use any external libraries, there are no limits to 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 in your name!

Getting ready

Make sure you have a Twitter user account and have created an application with Twitter (https://apps.twitter.com/app/new).

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

Create an access token by connecting...