CHAPTER 4

image

Workstation

A workstation can be defined as a system on which we have chef client installed, and which has knife configured properly. A workstation holds a local repository for chef server. It is a place where all the development work takes place, and then that work is uploaded to the chef server. It provides an interface to interact with the chef server. The main functions of a workstation can be

  • Uploading the items from the local chef repository to the chef server.
  • Installing chef on the nodes using a knife bootstrap operation.
  • Creating cookbooks.
  • Creating roles/environments or any other policies and then uploading them to the chef server.
  • Managing nodes using knife.

Prerequisite

Before we start with the installation, we must make sure we meet the prerequisites required to install and configure a workstation properly.

  • A working chef server with which we will configure our workstation.
  • Chef client requires at least 512MB of RAM, 15GB storage, and one vCPU (virtual CPU) running properly.
  • The node should be able to interact with the chef server via HTTPS.
  • Ruby should be installed (1.8.7 + versions).

For testing purposes we can use a t1.micro instance on AWS (Amazon Web Services) to run chef client. However, for a production client we should use instances with at least 2GB of RAM and 15GB of storage.

Operating System Support

Table 4-1 lists the operating systems (OSs) that currently support chef client.

Table 4-1. List of Operating Systems That Support Chef Client

Operating System

Version

Architecture

Debian

6 and above

i686, x86_64

Enterprise Linux

5.x, 6.x

i686, x86_64

Mac OS X

10.6, 10.7

x86_64

openSUSE

12.1

i686, x86_64

Solaris

5.9

Sparc

 

5.10. 5.11

i386, sparc

SUSE Enterprise

11.2

i686, x86_64

Ubuntu

10.04, 10.10, 11.04, 11.10, 12.04, 12.10

i686, x86_64

Windows

2003 R2, 2008

i686, x86_64

 

2008 R2, 2012

x86_64

Install and Configure a Workstation

In order to configure a workstation properly, several steps are necessary. Here we demonstrate the configuration of a workstation on an Enterprise Linux-based OS. The same steps can be used to configure it on any other OS.

  1. Identify the operating system.
  2. Install the chef client package.
  3. Copy the validator.pem and admin.pem from to the chef server.
  4. Configure knife.
  5. Install git (optional).
  6. Copy the knife configuration and key files in the chef repository.
  7. Verify the workstation configuration.

We cover each and every step in detail in the upcoming sections.

Identify the Operating System

This step mainly includes identifying the OS, which will help us in installing the relevant package on the system.

Install the Chef Client Package

There are two options to install the chef client package.

  1. Use the script provided by chef, which will install the latest version available.
  2. Download the relevant version and install it using a suitable method.

Go to www.getChef.com/Chef/install/.

Visit the chef client tab and select your OS and its architecture. You will find two ways to install the package, as shown in Figure 4-1, and you can use either method to install the package. We demonstrate here by using the second method.

9781430262954_Fig04-01.jpg

Figure 4-1. Downloading the chef package

Select the chef version and download it to the machine on which we will configure the workstation.

After downloading the installer, run it using a relevant method based upon your OS. For Windows, right-click and run as administrator and install (see Figure 4-2). For Enterprise Linux, download the rpm and install it.

9781430262954_Fig04-02.jpg

Figure 4-2. Installing the chef package

Verify the installation by typing chef client –v at the command line. It should return something like what we see in Figure 4-3.

9781430262954_Fig04-03.jpg

Figure 4-3. Verifying installation

Copy the Key Files from the Chef Server

The workstation needs some keys and configuration files to connect and authenticate with the chef server. The following items are required:

  • Knife configuration file (Knife.rb): It can be created using the knife configure command. We demonstrate this in the next section.
  • Knife user key file: It can be created using the knife configure command.
  • Chef validator key: This is a private key that is generated by the chef server when we configure it for the first time. We need to manually copy this file to .chef folder on the workstation.

Configure Knife

We demonstrate by configuring knife to an open source chef server. Run the knife configure command to configure the workstation and create the knife configuration file. Figure 4-4 shows this operation.

9781430262954_Fig04-04.jpg

Figure 4-4. Configuring knife

The following inputs are required to configure knife:

  • The path (for Linux /root/.chef and for Windows c:/users/user/.chef) to keep the configuration file.
  • The URL (uniform resource locator) of the chef server: It can be the IP (Internet provider) or the FQDN (fully qualified domain name) of the server. FQDN is preferred over IP.
  • Client name for API (application programming interface). The admin user to be used with knife.
  • Validation client name: Chef validator client that is automatically created with chef.
  • Location of validation key.
  • Path to a chef repository.

Install Git (Optional)

Git is required on the workstation if we want to clone the repository on github provided by Opscode. If we don’t want to do so, then we can create our own chef repository. This step is an optional, required only if we want to clone the repository provided by chef.

Place the Knife Configuration and Key Files in the .Chef Directory

By default, Chef looks for the knife configuration in the .Chef directory (for Linux /root/.chef and for Windows c:/users/user/.chef). So, you need to place the following items in that directory:

  • The knife configuration file
  • The chef validator key file
  • The user to be used to make the API calls

Verify the Workstation Configuration

To verify that our workstation is properly configured we run a test command.

Knife client list.

The command will list all the clients registered with chef server. The output will be similar to what we see in Figure 4-5.

9781430262954_Fig04-05.jpg

Figure 4-5. Verifying that chef is installed properly

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset