knife-cookbook
- upload and manage chef cookbooks
knife cookbook sub-command (options)
knife cookbook
supports the following sub commands:
knife cookbook list (options)
-a
, --all
-w
, --with-uri
Lists the cookbooks available on the Chef server.
knife cookbook show cookbook [version] [part] [filename] (options)
-f
, --fqdn fqdn
-p
, --platform platform
-v
, --platform-version version
show a particular part of a cookbook for the specified version. part can be one of:
knife cookbook upload [cookbooks...] (options)
-a
, --all
-o
, --cookbook-path path:path
-E
, --environment ENVIRONMENT
--freeze
--force
Uploads one or more cookbooks from your local cookbook repository(ies) to the Chef Server. Only files that don't yet exist on the server will be uploaded.
knife cookbook download cookbook [version] (options)
-d
, --dir download_directory
-f
, --force
-n
, --latest
download a cookbook from the chef server. if no version is specified and only one version exists on the server, that version will be downloaded. if no version is specified and multiple versions are available on the server, you will be prompted for a version to download.
knife cookbook delete cookbook [version] (options)
-a
, --all
-p
, --purge
delete the specified version of the named cookbook. if no version is specified, and only one version exists on the server, that version will be deleted. if multiple versions are available on the server, you will be prompted for a version to delete.
knife cookbook bulk delete regex (options)
-p
, --purge
delete cookbooks on the chef server based on a regular expression. the regular expression (regex) should be in quotes, not in //'s.
knife cookbook create cookbook (options)
-o
, --cookbook-path path
-r
, --readme-format format
-c
, --copyright copyright
-i
, --license license
-e
, --email email
this is a helper command that creates a new cookbook directory in the
cookbook_path
. the following directories and files are created for the
named cookbook.
supported readme formats are 'rdoc' (default), 'md', 'mkd', 'txt'. the readme file will be written with the specified extension and a set of helpful starting headers.
specify -c
or --copyright
with the name of the copyright holder as
your name or your company/organization name in a quoted string. if this
value is not specified an all-caps string your_company_name
is used
which can be easily changed with find/replace.
specify -i
or --license
with the license that the cookbook is
distributed under for sharing with other people or posting to the
opscode cookbooks site. be aware of the licenses of files you put inside
the cookbook and follow any restrictions they describe. when using
none
(default) or apachev2
, comment header text and metadata file
are pre-filled. the none
license will be treated as
non-redistributable.
specify -e
or --email
with the email address of the cookbook's
maintainer. if this value is not specified, an all-caps string
your_email
is used which can easily be changed with find/replace.
the cookbook copyright, license and email settings can be filled in the
knife.rb
, for example with default values:
cookbook_copyright "your_company_name"
cookbook_license "none"
cookbook_email "your_email"
knife cookbook metadata cookbook (options)
-a
, --all
-o
, --cookbook-path path:path
generate cookbook metadata for the named cookbook. the path used here specifies where the cookbooks directory is located and corresponds to the cookbook_path
configuration option.
knife cookbook metadata from file (options)
load the cookbook metadata from a specified file.
knife cookbook test [cookbooks...] (options)
-a
, --all
-o
, --cookbook-path path:path
test the specified cookbooks for syntax errors. this uses the built-in
ruby syntax checking option for files in the cookbook ending in .rb
,
and the erb syntax check for files ending in .erb
(templates).
knife recipe list [PATTERN]
List available recipes from the server. Specify PATTERN as a regular expression to limit the results.
Cookbooks are the fundamental unit of distribution in Chef. They encapsulate all recipes of resources and assets used to configure a particular aspect of the infrastructure. The following sub-commands can be used to manipulate the cookbooks stored on the Chef Server.
On disk, cookbooks are directories with a defined structure. The following directories may appear within a cookbook:
SPECIFICITY is a feature of files and templates that allow you
to specify alternate files to be used on a specific OS platform or host.
The default specificity setting is default, that is files in
COOKBOOK/files/default
will be used when a more specific copy is not
available. Further documentation for this feature is available on the
Chef wiki: http://wiki.opscode.com/display/chef/File+Distribution#FileDistribution-FileSpecificity
Cookbooks also contain a metadata file that defines various properties of the cookbook. The most important of these are the version and the dependencies. The version is used in combination with environments to select which copy of a given cookbook is distributed to a node. The dependencies are used by the server to determine which additional cookbooks must be distributed to a given host when it requires a cookbook.
knife-environment(1) knife-cookbook-site(1) http://wiki.opscode.com/display/chef/Cookbooks http://wiki.opscode.com/display/chef/Metadata
Chef was written by Adam Jacob adam@opscode.com with many contributions from the community.
This manual page was written by Joshua Timberman joshua@opscode.com. Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License.
Knife is distributed with Chef. http://wiki.opscode.com/display/chef/Home