Managing environments

There are multiple ways to manage environments in Chef. They are described in the following subsections.

Using Knife

Knife can be used to create, edit, delete, show information about a particular environment, or list all available environments. It can be used to push the configuration concerned with an environment through a file containing code written using Ruby DSL and eventually this file can be maintained in the version control system.

Creating a new environment

The knife environment create ENVIRONMENT_NAME command can be used to create a new environment. Let's use it to create a new environment called production and see the command in action:

$ knife environment create production

As soon as you execute this command, an editor ...

Get Mastering Chef now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.