Book Image

Mastering Chef

By : Mayank Joshi
Book Image

Mastering Chef

By: Mayank Joshi

Overview of this book

Table of Contents (20 chapters)
Mastering Chef
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
2
Knife and Its Associated Plugins
10
Data Bags and Templates
Index

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 ...