This page describes how to quickly get started using Shef, the Chef interactive Ruby console.
First, let's start Shef in "standalone" mode, so it doesn't inherit any other configuration. We run this with sudo so we can install a simple package in this example.
The next step is to enter recipe mode, so we can create actual resources that Chef will manage. We also turn off echoing return values to keep the terminal output clean.
Now we can start writing Resources directly into the console, and then run Chef to have them created on the system.
If we look at the local filesystem, we'll see this file has been created:
Neat!
Now let's take a look at how we can use a node attribute. Here, we'll set a node attribute, and then simply display it to the output log.
We first enter attributes editing mode, putting shef into the context of a node's attribute space. We set the attribute value, then we enter recipe mode to create a log resource.
Now let's put the content of this attribute into a file.
If we look at this file, we see it contains the string from the attribute we set earlier.
The next example will install a package on the local system.
The next example will install three gems that are optional for use with Knife sub-commands (fog, net-ssh-multi and highline)