LinuxCommandLibrary

chef

TLDR

Generate a new cookbook

$ chef generate cookbook [cookbook_name]
copy
Generate a new recipe
$ chef generate recipe [cookbook_name] [recipe_name]
copy
Verify cookbook syntax
$ chef exec cookstyle [cookbook_path]
copy
Run cookbook locally
$ chef-client --local-mode --runlist "[recipe[cookbook::recipe]]"
copy
Show installed version
$ chef --version
copy
Install gem into Chef
$ chef gem install [gem_name]
copy
Run InSpec tests
$ chef exec inspec exec [test_path]
copy

SYNOPSIS

chef command [options]

DESCRIPTION

chef is the command-line interface for Chef Workstation, a configuration management and infrastructure automation platform. It provides tools for developing, testing, and managing cookbooks that define system configurations.
Cookbooks contain recipes written in Ruby DSL that describe desired system states. Chef applies these recipes to nodes, ensuring consistent configuration across infrastructure. The workflow includes local development, testing with Test Kitchen, and deployment to Chef Server.

PARAMETERS

generate type name

Generate cookbook, recipe, template, or other component.
exec command
Run command in Chef context with bundled Ruby.
gem subcommand
Manage Ruby gems in Chef's environment.
install policyfile
Install cookbooks from Policyfile.
update policyfile
Update cookbooks in Policyfile.
export policyfile path
Export policy archive for deployment.
push policygroup policyfile_
Push policy to Chef Server.
--version
Show version information.
--help
Display help information.

CAVEATS

Requires Ruby knowledge for recipe development. Chef Server setup needed for centralized management. Local mode testing requires sufficient resources. Cookbooks may have complex dependencies.

HISTORY

Chef was created by Adam Jacob at Opscode (later Chef Software) in 2009. It pioneered the "infrastructure as code" concept alongside Puppet. Chef was written in Ruby and Erlang, and gained popularity for its flexibility. In 2020, Chef was acquired by Progress Software. The tooling has evolved from knife-centric workflows to modern Chef Workstation.

SEE ALSO

knife(1), kitchen(1), inspec(1), ansible(1), puppet(1)

Copied to clipboard