Reader small image

You're reading from  Mastering Chef

Product typeBook
Published inJun 2015
Reading LevelIntermediate
Publisher
ISBN-139781783981564
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Mayank Joshi
Mayank Joshi
author image
Mayank Joshi

Mayank Joshi works for Indix as a DevOps engineer. He has worn many hats during his 10-year long career. He has been a developer, a systems analyst, a systems administrator, a software consultant, and for the past 6 years, he has been fascinated with the phenomenal growth witnessed in cloud environments and the challenges of automation associated with the hosting of the infrastructure in such environments. Prior to Indix, he worked for start-ups such as SlideShare, R&D organizations such as CDAC, and even had a stint at a highly automated chemical plant of IFFCO.
Read more about Mayank Joshi

Right arrow

Chapter 2. Knife and Its Associated Plugins

We learned about the Chef ecosystem in the last chapter and, as we saw, Knife is one of those tools that we'll be using the most while doing development. In this chapter, we'll look at the internals of Knife and we'll also see different plugins, which will make your life a lot easier while managing your infrastructure using Chef.

Introducing Knife


Knife is a command-line tool that comes bundled with the Chef installation. Depending upon how Chef was installed, you may find the binary at any particular location on your workstation. Since I have installed Chef using rvm and gem packaging, it is found at ~/.rvm/gems/ruby-2.1.0/gems/chef-11.8.2/bin/knife.

Depending upon your setup, you may find it at some other location. Whatever the location, ensure that it is in your PATH variable.

Knife is used for almost every aspect of managing your interactions with chef-server. It helps us manage:

  • Cookbooks

  • Environments

  • Roles

  • Data bags

  • Nodes

  • API clients

  • Bootstrapping of instances

  • Searching for nodes

Let's see what the knife command has to offer to us. Just fire up the terminal and enter the command:

$knife
ERROR: You need to pass a sub-command (e.g., knife SUB-COMMAND)
Usage: knife sub-command (options)
    -s, --server-url URL             Chef Server URL
        --chef-zero-port PORT        Port to start chef-zero on
    -k, --key KEY ...

Summary


In this chapter, we learned about one of the most widely used components of Chef's ecosystem, called Knife. We looked at the different subcommands of Knife, configuring Knife, and finally some plugins that can be used to extend Knife's functionality.

In the next chapter, we will see why we need to learn Ruby and write efficient infrastructure code using Ruby.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Mastering Chef
Published in: Jun 2015Publisher: ISBN-13: 9781783981564
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Mayank Joshi

Mayank Joshi works for Indix as a DevOps engineer. He has worn many hats during his 10-year long career. He has been a developer, a systems analyst, a systems administrator, a software consultant, and for the past 6 years, he has been fascinated with the phenomenal growth witnessed in cloud environments and the challenges of automation associated with the hosting of the infrastructure in such environments. Prior to Indix, he worked for start-ups such as SlideShare, R&D organizations such as CDAC, and even had a stint at a highly automated chemical plant of IFFCO.
Read more about Mayank Joshi