Skip to end of metadata
Go to start of metadata


Overview

Knife is a command-line tool that comes with Chef.

It is used by administrators to interact with the Chef Server API, the local Chef repository and and can be used to manage environments within one Chef setup (or one organization on Hosted Chef).

Knife's environment sub-command provides this capability.

  • For more information about Knife, refer to the Knife documentation.
  • See Environments for more information on Environments.

create

Creates a new environment object on the Chef Server.

Usage:

Knife will open $EDITOR and allow you to edit the ENVIRONMENT description. Once you are done editing, knife will save the environment to the Chef Server.

Additional Options:

  • -d, --description DESCRIPTION:
    The value of the description field.

delete

Deletes an environment on the Chef Server.

Usage:

edit

Edit an existing environment using $EDITOR.

Usage:

from file

Create or update an environment from a JSON or Ruby DSL description of the environment. See [Environment] for more details.

Usage:

list

List all the of the environments saved on the Chef Server.

Usage:

Additional Options:

  • -w, --with-uri:
    Show the resource URI for each environment

Example:

To list nodes within an environment, use search. Within the context of search, the chef_environment of a node is treated like an attribute. The following will result in a list of nodes within a the dev environment:

see Searching within Environments below for an additional example.

show

Show the information for a given environment.

Usage:

Examples:



Managing Data Bags With Knife


Managing Nodes With Knife



Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.