.\" generated with Ronn/v0.6.0 .\" http://github.com/rtomayko/ronn/ . .TH "KNIFE" "8" "July 2010" "" "" . .SH "NAME" \fBknife\fR \- Chef Server REST API utility . .SH "SYNOPSIS" \fBknife\fR\fIsub\-command\fR\fI(options)\fR . .SH "DESCRIPTION" This manual page documents knife, a command\-line utility used to interact with a Chef server directly through the RESTful API\. Knife uses sub\-commands to take various actions on different types of Chef objects\. Some sub\-commands take additional options\. General options follow sub\-commands and their options\. A configuration file can be created for common defaults\. . .P Unless otherwise specified, output is in JSON format, and input files are also JSON format\. . .P The Chef class \fBChef::Config\fR that configures the behavior of how knife runs has options that correspond to command\-line options\. These are noted as \fBChef::Config\fR values\. . .SH "GENERAL OPTIONS" . .TP \fB\-s\fR, \fB\-\-server\-url\fR URL Chef Server URL, corresponds to \fBChef::Config\fR\fBchef_server_url\fR\. . .TP \fB\-k\fR, \fB\-\-key\fR KEY API Client Key, corresponds to \fBChef::Config\fR\fBclient_key\fR\. . .TP \fB\-c\fR, \fB\-\-config\fR CONFIG The configuration file to use . .TP \fB\-e\fR, \fB\-\-editor\fR EDITOR Set the editor to use for interactive commands . .TP \fB\-F\fR, \fB\-\-format\fR FORMAT Which format to use for output . .TP \fB\-l\fR, \fB\-\-log_level\fR LEVEL Set the log level (debug, info, warn, error, fatal), corresponds to \fBChef::Config\fR\fBlog_level\fR\. . .TP \fB\-L\fR, \fB\-\-logfile\fR LOGLOCATION Set the log file location, defaults to STDOUT, corresponds to \fBChef::Config\fR\fBlog_location\fR\. . .TP \fB\-n\fR, \fB\-\-no\-editor\fR Do not open EDITOR, just accept the data as is . .TP \fB\-u\fR, \fB\-\-user\fR USER API Client Username, corresponds to \fBChef::Config\fR\fBnode_name\fR\. . .TP \fB\-p\fR, \fB\-\-print\-after\fR Show the data after a destructive operation . .TP \fB\-v\fR, \fB\-\-version\fR Show chef version . .TP \fB\-y\fR, \fB\-\-yes\fR Say yes to all prompts for confirmation . .TP \fB\-h\fR, \fB\-\-help\fR Show this message . .P Usage information for sub\-commands can be displayed with \fBknife SUB\-COMMAND \-\-help\fR\. . .SH "SUB\-COMMANDS" Knife sub\-commands are structured as \fINOUN verb NOUN (options)\fR\. The sub\-commands are meant to be intuitively named\. Because the Chef Server API is RESTful, sub\-commands generally utilize CRUD operations\. . .IP "\(bu" 4 create (create) . .IP "\(bu" 4 list and show (read) . .IP "\(bu" 4 edit (update) . .IP "\(bu" 4 delete (destroy) . .IP "" 0 . .P Objects stored on the server support these, as described below\. . .SH "GENERAL SUB\-COMMANDS" The following are general sub\-commands that do not fit within the other object types utilized in the Chef Server API\. . .P \fBconfigure\fR\fI(options)\fR . .TP \fB\-i\fR, \fB\-\-initial\fR Create an initial API Client . .TP \fB\-r\fR, \fB\-\-repository REPO\fR The path to your chef\-repo . .P Create a configuration file for knife\. This will prompt for values to enter into the file\. Default values are listed in square brackets if no other entry is typed\. See \fBCONFIGURATION\fR below for available options\. . .P \fBconfigure client DIRECTORY\fR . .P Read the \fBknife\.rb\fR config file and generate a config file suitable for use in \fB/etc/chef/client\.rb\fR and copy the validation certificate into the specified \fIDIRECTORY\fR\. . .P \fBindex rebuild\fR\fI(options)\fR . .TP \fB\-y\fR, \fB\-\-yes\fR don\'t bother to ask if I\'m sure . .P Rebuilds all the search indexes on the server\. . .P \fBrecipe list [PATTERN]\fR . .P List available recipes from the server\. Specify \fIPATTERN\fR as a regular expression to limit the results\. . .P \fBsearch INDEX QUERY\fR\fI(options)\fR . .TP \fB\-a\fR, \fB\-\-attribute ATTR\fR Show only one attribute . .TP \fB\-i\fR, \fB\-\-id\-only\fR Show only the ID of matching objects . .TP \fB\-R\fR, \fB\-\-rows INT\fR The number of rows to return . .TP \fB\-r\fR, \fB\-\-run\-list\fR Show only the run list . .TP \fB\-o\fR, \fB\-\-sort SORT\fR The order to sort the results in . .TP \fB\-b\fR, \fB\-\-start ROW\fR The row to start returning results at . .P Search indexes are a feature of the Chef Server and the search sub\-command allows querying any of the available indexes using SOLR query syntax\. The following data types are indexed for search: \fInode\fR, \fIrole\fR, \fIclient\fR, \fIdata bag\fR\. . .P \fBssh QUERY COMMAND\fR\fI(options)\fR . .TP \fB\-a\fR, \fB\-\-attribute ATTR\fR The attribute to use for opening the connection \- default is fqdn . .TP \fB\-C\fR, \fB\-\-concurrency NUM\fR The number of concurrent connections . .TP \fB\-m\fR, \fB\-\-manual\-list\fR QUERY is a space separated list of servers . .TP \fB\-P\fR, \fB\-\-ssh\-password PASSWORD\fR The ssh password . .TP \fB\-x\fR, \fB\-\-ssh\-user USERNAME\fR The ssh username . .P The \fIssh\fR sub\-command opens an ssh session to each of the nodes in the search results of the \fIQUERY\fR\. This sub\-command requires that the net\-ssh\-multi and highline Ruby libraries are installed\. On Debian systems, these are the libnet\-ssh\-multi\-ruby and libhighline\-ruby packages\. They can also be installed as RubyGems (net\-ssh\-multi and highline, respectively)\. . .SH "BOOTSTRAP SUB\-COMMANDS" \fBbootstrap FQDN\fR\fI(options)\fR . .TP \fB\-i\fR, \fB\-\-identity\-file IDENTITY_FILE\fR The SSH identity file used for authentication . .TP \fB\-N\fR, \fB\-\-node\-name NAME\fR The Chef node name for your new node . .TP \fB\-P\fR, \fB\-\-ssh\-password PASSWORD\fR The ssh password . .TP \fB\-x\fR, \fB\-\-ssh\-user USERNAME\fR The ssh username . .TP \fB\-\-prerelease\fR Install pre\-release Chef gems . .TP \fB\-r\fR, \fB\-\-run\-list RUN_LIST\fR Comma separated list of roles/recipes to apply . .TP \fB\-P\fR, \fB\-\-ssh\-password PASSWORD\fR The ssh password . .TP \fB\-x\fR, \fB\-\-ssh\-user USERNAME\fR The ssh username . .TP \fB\-\-template\-file TEMPLATE\fR Full path to location of template to use . .TP \fB\-\-sudo\fR Execute the bootstrap via sudo . .TP \fB\-d\fR, \fB\-\-distro DISTRO\fR Bootstrap a distro using a template . .P Performs a Chef Bootstrap on the target node\. The goal of the bootstrap is to get Chef installed on the target system so it can run Chef Client with a Chef Server\. The main assumption is a baseline OS installation exists\. This sub\-command is used internally by some cloud computing server create commands and the others will be migrated in a future version of Chef\. . .P As of Chef 0\.9\.8, the bootstrap sub\-command supports supplying a template to perform the bootstrap steps\. If the distro is not specified (via \fB\-d\fR or \fB\-\-distro\fR option), an Ubuntu 10\.04 with RubyGems is assumed\. The \fBDISTRO\fR value corresponds to the base filename of the template, in other words \fBDISTRO\fR\.erb\. A template file can be specified with the \fB\-\-template\-file\fR option in which case the \fBDISTRO\fR is not used\. The sub\-command looks in the following locations for the template to use: . .IP "\(bu" 4 \fBbootstrap\fR directory in the installed Chef Knife library\. . .IP "\(bu" 4 \fBbootstrap\fR directory in the \fB$PWD/\.chef\fR\. . .IP "\(bu" 4 \fBbootstrap\fR directory in the users \fB$HOME/\.chef\fR\. . .IP "" 0 . .P The default bootstrap templates are scripts that get copied to the target node (FQDN)\. As of Chef 0\.9\.8, the following distros are supported: . .IP "\(bu" 4 centos5\-gems . .IP "\(bu" 4 fedora13\-gems . .IP "\(bu" 4 ubuntu10\.04\-gems . .IP "\(bu" 4 ubuntu10\.04\-apt . .IP "" 0 . .P The gems installations will use RubyGems 1\.3\.6 and Chef installed as a gem\. The apt installation will use the Opscode APT repository\. The RubyGems installation requires installing gems with native extensions, so development related packages (ruby\-dev, build\-essential) are installed\. These are not installed with the apt installation, as native extensions are already compiled in the required packages\. . .P In addition to handling the software installation, these bootstrap templates do the following: . .IP "\(bu" 4 Write the validation\.pem per the local knife configuration\. . .IP "\(bu" 4 Write a default config file for Chef (\fB/etc/chef/client\.rb\fR) using values from the \fBknife\.rb\fR\. . .IP "\(bu" 4 Create a JSON attributes file containing the specified run list and run Chef\. . .IP "" 0 . .P In the case of the RubyGems, the \fBclient\.rb\fR will be written from scratch with a minimal set of values; see \fBEXAMPLES\fR\. In the case of APT Package installation, \fBclient\.rb\fR will have the \fBvalidation_client_name\fR appended if it is not set to \fBchef\-validator\fR (default config value), and the \fBnode_name\fR will be added if \fBchef_node_name\fR option is specified\. . .P When this is complete, the bootstrapped node will have: . .IP "\(bu" 4 Latest Chef version installed from RubyGems or APT Packages from Opscode\. This may be a later version than the local system\. . .IP "\(bu" 4 Be validated with the configured Chef Server\. . .IP "\(bu" 4 Have run Chef with its default run list if one is specfied\. . .IP "" 0 . .P Additional custom bootstrap templates can be created and stored in \fB\.chef/bootstrap/DISTRO\.erb\fR, replacing \fBDISTRO\fR with the value passed with the \fB\-d\fR or \fB\-\-distro\fR option\. See \fBEXAMPLES\fR for more information\. . .SH "CLIENT SUB\-COMMANDS" Clients are entities that communicate with the Chef Server API\. . .P \fBclient bulk delete REGEX\fR\fI(options)\fR . .P Delete clients on the Chef Server based on a regular expression\. The regular expression (\fIREGEX\fR) should be in quotes, not in //\'s\. . .P \fBclient create CLIENT\fR\fI(options)\fR . .TP \fB\-a\fR, \fB\-\-admin\fR Create the client as an admin . .TP \fB\-f\fR, \fB\-\-file FILE\fR Write the key to a file . .P Create a new client\. This generates an RSA keypair\. The private key will be displayed on \fISTDOUT\fR or written to the named file\. The public half will be stored on the Server\. For \fIchef\-client\fR systems, the private key should be copied to the system as \fB/etc/chef/client\.pem\fR\. . .P Admin clients should be created for users that will use \fIknife\fR to access the API as an administrator\. The private key will generally be copied to \fB~/\.chef/CLIENT\.pem\fR and referenced in the \fBknife\.rb\fR configuration file\. . .P \fBclient delete CLIENT\fR\fI(options)\fR . .P Deletes a registered client\. . .P \fBclient edit CLIENT\fR\fI(options)\fR . .P Edit a registered client\. . .P \fBclient list\fR\fI(options)\fR . .TP \fB\-w\fR, \fB\-\-with\-uri\fR Show corresponding URIs . .P List all registered clients\. . .P \fBclient reregister CLIENT\fR\fI(options)\fR . .TP \fB\-f\fR, \fB\-\-file FILE\fR Write the key to a file . .P Regenerate the RSA keypair for a client\. The public half will be stored on the server and the private key displayed on \fISTDOUT\fR or written to the named file\. . .P \fBclient show CLIENT\fR\fI(options)\fR . .TP \fB\-a\fR, \fB\-\-attribute ATTR\fR Show only one attribute . .P Show a client\. . .SH "COOKBOOK SUB\-COMMANDS" 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\. . .P \fBcookbook bulk delete REGEX\fR\fI(options)\fR . .TP \fB\-p\fR, \fB\-\-purge\fR Purge files from backing store\. This will disable any cookbook that contains any of the same files as the cookbook being purged\. . .P Delete cookbooks on the Chef Server based on a regular expression\. The regular expression (\fIREGEX\fR) should be in quotes, not in //\'s\. . .P \fBcookbook create COOKBOOK\fR\fI(options)\fR . .TP \fB\-o\fR, \fB\-\-cookbook\-path PATH\fR The directory where the cookbook will be created . .TP \fB\-r\fR, \fB\-\-readme\-format FORMAT\fR Format of the README file . .TP \fB\-C\fR, \fB\-\-copyright COPYRIGHT\fR Name of Copyright holder . .TP \fB\-I\fR, \fB\-\-license LICENSE\fR License for cookbook, apachev2 or none . .TP \fB\-E\fR, \fB\-\-email EMAIL\fR Email address of cookbook maintainer . .P This is a helper command that creates a new cookbook directory in the \fBcookbook_path\fR\. The following directories and files are created for the named cookbook\. . .IP "\(bu" 4 COOKBOOK/attributes . .IP "\(bu" 4 COOKBOOK/definitions . .IP "\(bu" 4 COOKBOOK/files/default . .IP "\(bu" 4 COOKBOOK/libraries . .IP "\(bu" 4 COOKBOOK/metadata\.rb . .IP "\(bu" 4 COOKBOOK/providers . .IP "\(bu" 4 COOKBOOK/README\.rdoc . .IP "\(bu" 4 COOKBOOK/recipes/default\.rb . .IP "\(bu" 4 COOKBOOK/resources . .IP "\(bu" 4 COOKBOOK/templates/default . .IP "" 0 . .P 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\. . .P Specify \fB\-C\fR or \fB\-\-copyright\fR 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 \fBYOUR_COMPANY_NAME\fR is used which can be easily changed with find/replace\. . .P Specify \fB\-I\fR or \fB\-\-license\fR 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 \fBnone\fR (default) or \fBapachev2\fR, comment header text and metadata file are pre\-filled\. The \fBnone\fR license will be treated as non\-redistributable\. . .P Specify \fB\-E\fR or \fB\-\-email\fR with the email address of the cookbook\'s maintainer\. If this value is not specified, an all\-caps string \fBYOUR_EMAIL\fR is used which can easily be changed with find/replace\. . .P The cookbook copyright, license and email settings can be filled in the \fBknife\.rb\fR, for example with default values: . .IP "" 4 . .nf cookbook_copyright \"YOUR_COMPANY_NAME\" cookbook_license \"none\" cookbook_email \"YOUR_EMAIL\" . .fi . .IP "" 0 . .P \fBcookbook delete COOKBOOK [VERSION]\fR\fI(options)\fR . .TP \fB\-a\fR, \fB\-\-all\fR Delete all versions . .TP \fB\-p\fR, \fB\-\-purge\fR Purge files from backing store\. This will disable any cookbook that contains any of the same files as the cookbook being purged\. . .P Delete the specified \fIVERSION\fR of the named \fICOOKBOOK\fR\. 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\. . .P \fBcookbook download COOKBOOK [VERSION]\fR\fI(options)\fR . .TP \fB\-d\fR, \fB\-\-dir DOWNLOAD_DIRECTORY\fR The directory to download the cookbook into . .TP \fB\-f\fR, \fB\-\-force\fR Overwrite an existing directory with the download . .TP \fB\-N\fR, \fB\-\-latest\fR Download the latest version of the cookbook . .P 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\. . .P \fBcookbook list\fR\fI(options)\fR . .TP \fB\-w\fR, \fB\-\-with\-uri\fR Show corresponding URIs . .P List all the cookbooks\. . .P \fBcookbook metadata COOKBOOK\fR\fI(options)\fR . .TP \fB\-a\fR, \fB\-\-all\fR Generate metadata for all cookbooks, rather than just a single cookbook . .TP \fB\-o\fR, \fB\-\-cookbook\-path PATH:PATH\fR A colon\-separated path to look for cookbooks in . .P Generate cookbook metadata for the named \fICOOKBOOK\fR\. The \fIPATH\fR used here specifies where the cookbooks directory is located and corresponds to the \fBcookbook_path\fR configuration option\. . .P \fBcookbook metadata from FILE\fR\fI(options)\fR . .P Load the cookbook metadata from a specified file\. . .P \fBcookbook show COOKBOOK [VERSION] [PART] [FILENAME]\fR\fI(options)\fR . .TP \fB\-f\fR, \fB\-\-fqdn FQDN\fR The FQDN of the host to see the file for . .TP \fB\-p\fR, \fB\-\-platform PLATFORM\fR The platform to see the file for . .TP \fB\-V\fR, \fB\-\-platform\-version VERSION\fR The platform version to see the file for . .P Show a particular part of a \fICOOKBOOK\fR for the specified \fIVERSION\fR\. \fIPART\fR can be one of: . .IP "\(bu" 4 \fIattributes\fR . .IP "\(bu" 4 \fIdefinitions\fR . .IP "\(bu" 4 \fIfiles\fR . .IP "\(bu" 4 \fIlibraries\fR . .IP "\(bu" 4 \fIproviders\fR . .IP "\(bu" 4 \fIrecipes\fR . .IP "\(bu" 4 \fIresources\fR . .IP "\(bu" 4 \fItemplates\fR . .IP "" 0 . .P \fBcookbook test [COOKBOOKS\.\.\.]\fR\fI(options)\fR . .TP \fB\-a\fR, \fB\-\-all\fR Test all cookbooks, rather than just a single cookbook . .TP \fB\-o\fR, \fB\-\-cookbook\-path PATH:PATH\fR A colon\-separated path to look for cookbooks in . .P Test the specified cookbooks for syntax errors\. This uses the built\-in Ruby syntax checking option for files in the cookbook ending in \fB\.rb\fR, and the ERB syntax check for files ending in \fB\.erb\fR (templates)\. . .P \fBcookbook upload [COOKBOOKS\.\.\.]\fR\fI(options)\fR . .TP \fB\-a\fR, \fB\-\-all\fR Upload all cookbooks, rather than just a single cookbook . .TP \fB\-o\fR, \fB\-\-cookbook\-path PATH:PATH\fR A colon\-separated path to look for cookbooks in . .P Uploads the specified cookbooks to the Chef Server\. The actual upload executes a number of commands, most of which occur on the local machine\. The cookbook is staged in a temporary location\. Then the \fBcookbook_path\fR (or \fB\-o PATH\fR) is processed to search for the named cookbook, and each occurance is copied in the order specified\. A syntax check is performed a la \fBcookbook test\fR, above\. The metadata is generated, a la \fBcookbook metadata\fR\. A gzip(1)\'ed, tar(1) file is created, and is uploaded to the server\. . .SH "COOKBOOK SITE SUB\-COMMANDS" The following sub\-commands are still in the context of cookbooks, but they make use of Opscode\'s Cookbook Community site, \fIhttp://cookbooks\.opscode\.com/\fR\. That site has an API, and these sub\-commands utilize that API, rather than the Chef Server API\. . .P \fBcookbook site download COOKBOOK [VERSION]\fR\fI(options)\fR . .TP \fB\-f\fR, \fB\-\-file FILE\fR The filename to write to . .P Downloads a specific cookbook from the Community site, optionally specifying a certain version\. . .P \fBcookbook site list\fR\fI(options)\fR . .TP \fB\-w\fR, \fB\-\-with\-uri\fR Show corresponding URIs . .P Lists available cookbooks from the Community site\. . .P \fBcookbook site search QUERY\fR\fI(options)\fR . .P Searches the Community site with the specified query\. . .P \fBcookbook site share COOKBOOK CATEGORY\fR\fI(options)\fR . .TP \fB\-k\fR, \fB\-\-key KEY\fR API Client Key . .TP \fB\-u\fR, \fB\-\-user USER\fR API Client Username . .TP \fB\-o\fR, \fB\-\-cookbook\-path PATH:PATH\fR A colon\-separated path to look for cookbooks in . .P Uploads the specified cookbook using the given category to the Opscode cookbooks site\. Requires a login user and certificate for the Opscode Cookbooks site\. See \fBEXAMPLES\fR for usage if the Opscode user and certificate pair are not used for authenticating with the Chef Server\. In other words, if the Chef Server is not the Opscode Platform\. . .P \fBcookbook site unshare COOKBOOK\fR . .P Stops sharing the specified cookbook on the Opscode cookbooks site\. . .P \fBcookbook site show COOKBOOK [VERSION]\fR\fI(options)\fR . .P Shows information from the site about a particular cookbook\. . .P \fBcookbook site vendor COOKBOOK [VERSION]\fR\fI(options)\fR . .TP \fB\-d\fR, \fB\-\-dependencies\fR Grab dependencies automatically . .P Uses \fBgit\fR version control in conjunction with the cookbook site to download upstream cookbooks\. A new vendor branch is created in git, the cookbook downloaded from the site and untarred, then the master branch is merged\. This allows the user to track upstream changes to cookbooks while merging in customizations\. If \fI\-d\fR is specified, all the cookbooks it depends on (via metadata \fIdependencies\fR) are downloaded and untarred as well, each using their own vendor branch\. . .SH "DATA BAG SUB\-COMMANDS" Data bags are stores of JSON blobs\. These blobs are called items\. They are free form JSON and indexed by the Chef Server\. . .P \fBdata bag create BAG [ITEM]\fR\fI(options)\fR . .P Create a new data bag, or an item in a data bag\. . .P \fBdata bag delete BAG [ITEM]\fR\fI(options)\fR . .P Delete a data bag, or an item from a data bag\. . .P \fBdata bag edit BAG ITEM\fR\fI(options)\fR . .P Edit an item in a data bag\. . .P \fBdata bag from file BAG FILE\fR\fI(options)\fR . .P Load a data bag item from a JSON file\. Looks in the directory \fBdata_bags/BAG/ITEM\.json\fR unless a relative path is specified\. . .P \fBdata bag list\fR\fI(options)\fR . .TP \fB\-w\fR, \fB\-\-with\-uri\fR Show corresponding URIs . .P List the available data bags\. . .P \fBdata bag show BAG [ITEM]\fR\fI(options)\fR . .P Show a specific data bag or an item in a data bag\. . .SH "NODE SUB\-COMMANDS" Nodes are the entities which are configured with Chef\. Typically these are servers or workstations\. Nodes are registered as a client, by default by the fully qualified domain name (fqdn)\. A single client may configure more than one node\. . .P \fBnode bulk delete REGEX\fR\fI(options)\fR . .P Delete nodes on the Chef Server based on a regular expression\. The regular expression (\fIREGEX\fR) should be in quotes, not in //\'s\. . .P \fBnode create NODE\fR\fI(options)\fR . .P Create a new node\. . .P \fBnode delete NODE\fR\fI(options)\fR . .P Delete a single node\. . .P \fBnode edit NODE\fR\fI(options)\fR . .P Edit a node\. . .P \fBnode from file FILE\fR\fI(options)\fR . .P Create a node from a JSON file\. . .P \fBnode list\fR\fI(options)\fR . .TP \fB\-w\fR, \fB\-\-with\-uri\fR Show corresponding URIs . .P List all nodes\. . .P \fBnode run_list add [NODE] [ENTRY]\fR\fI(options)\fR . .TP \fB\-a\fR, \fB\-\-after ITEM\fR Place the ENTRY in the run list after ITEM . .P Add a recipe or role to the node\'s \fBrun_list\fR\. . .P \fBnode run_list remove [NODE] [ENTRY]\fR\fI(options)\fR . .P Remove a recipe or role from the node\'s \fBrun_list\fR\. . .P \fBnode show NODE\fR\fI(options)\fR . .TP \fB\-a\fR, \fB\-\-attribute [ATTR]\fR Show only one attribute . .TP \fB\-r\fR, \fB\-\-run\-list\fR Show only the run list . .P Show a node\. . .SH "RECIPE SUB\-COMMANDS" \fBrecipe list [PATTERN]\fR . .P List the recipes available on the server\. The results shown can be limited with the optional PATTERN, which is a regular expression\. PATTERN should be given in quotes, without slashes\. . .SH "ROLE SUB\-COMMANDS" \fBrole bulk delete REGEX\fR\fI(options)\fR . .P Delete roles on the Chef Server based on a regular expression\. The regular expression (\fIREGEX\fR) should be in quotes, not in //\'s\. . .P \fBrole create ROLE\fR\fI(options)\fR . .TP \fB\-d\fR, \fB\-\-description\fR The role description . .P Create a new role\. . .P \fBrole delete ROLE\fR\fI(options)\fR . .P Delete a role\. . .P \fBrole edit ROLE\fR\fI(options)\fR . .P Edit a role\. . .P \fBrole from file FILE\fR\fI(options)\fR . .P Create or update a role from a role Ruby DSL (\fB\.rb\fR) or JSON file\. . .P \fBrole list\fR\fI(options)\fR . .TP \fB\-w\fR, \fB\-\-with\-uri\fR Show corresponding URIs . .P List roles\. . .P \fBrole show ROLE\fR\fI(options)\fR . .TP \fB\-a\fR, \fB\-\-attribute ATTR\fR Show only one attribute . .P Show a specific role\. . .SH "CLOUD COMPUTING SUB\-COMMANDS" The next sections describe sub\-commands to work with various Cloud Computing APIs to launch server instances with validation and run\-time configuration that Chef knows about\. These sub\-commands require the fog Ruby library\. On Debian and Ubuntu systems with Opscode\'s apt repository (apt\.opscode\.com), this is the package \fBlibfog\-ruby\fR\. It is also available as a RubyGem, \fBfog\fR\. . .P The Rackspace and Terremark server creation sub\-commands are at an early stage of development\. They do not yet use the \fBbootstrap\fR sub\-command to install Chef, and make a few assumptions to be aware\. Right now when creating instances of these types, knife will assume an Ubuntu image, install Ruby from packages, RubyGems from source and Chef as a RubyGem\. As these commands are developed further, they will utilize the \fBbootstrap\fR sub\-command\. . .P In order to use knife with the various \fBCLOUD COMPUTING SUB\-COMMANDS\fR, credentials need to be added to the configuration file\. See \fBCONFIGURATION\fR\. . .SH "EC2 SUB\-COMMANDS" Chef is commonly used with Amazon AWS EC2 nodes\. This sub\-command will generate instance metadata that can be used to automatically configure an EC2 instance with Chef\. This requires an AMI that has Chef preinstalled with a configuration file that can parse the metadata at run\-time\. At this time this is the only sub\-command for EC2, but more may be added later similar to \fBRACKSPACE\fR and \fBTERREMARK\fR below\. . .P \fBec2 instance data [RUN LIST\.\.\.]\fR\fI(options)\fR . .TP \fB\-e\fR, \fB\-\-edit\fR Edit the instance data . .P The \fIRUN LIST\fR should be specified as a space separated list of roles or recipes that will be used by the instance to configure the server\. . .P \fBec2 server create [RUN LIST\.\.\.]\fR\fI(options)\fR . .TP \fB\-Z\fR, \fB\-\-availability\-zone ZONE\fR The Availability Zone . .TP \fB\-\-region\fR Your AWS region . .TP \fB\-A\fR, \fB\-\-aws\-access\-key\-id KEY\fR Your AWS Access Key ID . .TP \fB\-K SECRET\fR, \fB\-\-aws\-secret\-access\-key\fR Your AWS API Secret Access Key . .TP \fB\-f\fR, \fB\-\-flavor FLAVOR\fR The flavor of server (m1\.small, m1\.medium, etc) . .TP \fB\-i\fR, \fB\-\-image IMAGE\fR The AMI for the server . .TP \fB\-G\fR, \fB\-\-groups X,Y,Z\fR The security groups for this server . .TP \fB\-S\fR, \fB\-\-ssh\-key KEY\fR The SSH root key, corresponds to an Amazon Keypair\. . .TP \fB\-I\fR, \fB\-\-identity\-file IDENTITY_FILE\fR The SSH identity file used for authentication, passed to \fBbootstrap\fR\. . .TP \fB\-P\fR, \fB\-\-ssh\-password PASSWORD\fR The ssh password, passed to \fBbootstrap\fR\. . .TP \fB\-x\fR, \fB\-\-ssh\-user USERNAME\fR The ssh username, passed to \fBbootstrap\fR\. . .TP \fB\-\-prerelease\fR Install pre\-release Chef gems, passed to \fBbootstrap\fR\. . .TP \fB\-\-template\-file TEMPLATE\fR Full path to location of template to use, passed to \fBbootstrap\fR\. . .TP \fB\-d\fR, \fB\-\-distro DISTRO\fR Bootstrap a distro using a template, passed to \fBbootstrap\fR\. . .P Creates a new Amazon AWS EC2 instance and bootstraps it by calling the \fBbootstrap\fR sub\-command\. The \fB[RUN LIST\.\.\.]\fR items are passed to the bootstrap\'s \fBrun_list\fR config parameter/option\. See the \fBBOOTSTRAP SUB\-COMMANDS\fR section above for more information\. . .P \fBec2 server delete SERVER [SERVER]\fR\fI(options)\fR . .TP \fB\-A\fR, \fB\-\-aws\-access\-key\-id KEY\fR Your AWS Access Key ID . .TP \fB\-K SECRET\fR, \fB\-\-aws\-secret\-access\-key\fR Your AWS API Secret Access Key . .P Terminates a running Amazon AWS EC2 instance\. . .P \fBec2 server list [RUN LIST\.\.\.]\fR\fI(options)\fR . .TP \fB\-A\fR, \fB\-\-aws\-access\-key\-id KEY\fR Your AWS Access Key ID . .TP \fB\-K SECRET\fR, \fB\-\-aws\-secret\-access\-key\fR Your AWS API Secret Access Key . .P List running Amazon AWS EC2 instances\. . .SH "RACKSPACE SUB\-COMMANDS" In addition to EC2 nodes, Chef can be used on Rackspace Cloud nodes\. The following sub\-commands allow manipulating Rackspace Cloud nodes via the \fBfog\fR library\. . .P \fBrackspace server create [RUN LIST\.\.\.]\fR\fI(options)\fR . .TP \fB\-K\fR, \fB\-\-rackspace\-api\-key KEY\fR Your rackspace API key . .TP \fB\-A USERNAME\fR, \fB\-\-rackspace\-api\-username\fR Your rackspace API username . .TP \fB\-f\fR, \fB\-\-flavor FLAVOR\fR The flavor of server . .TP \fB\-i\fR, \fB\-\-image IMAGE\fR The image of the server . .TP \fB\-N\fR, \fB\-\-server\-name NAME\fR The server name . .P Creates a new Rackspace Cloud server\. . .P \fBrackspace server delete SERVER\fR\fI(options)\fR . .P Deletes a running Rackspace Cloud server\. . .P \fBrackspace server list\fR\fI(options)\fR . .P Lists running Rackspace Cloud servers\. . .SH "SLICEHOST SUB\-COMMANDS" As above, Chef can also be used on Slicehost nodes\. The following sub\-commands allow manipulating Slicehost nodes via the \fBfog\fR library\. . .P \fBslicehost server create [RUN LIST\.\.\.]\fR\fI(options)\fR * \fB\-f\fR, \fB\-\-flavor FLAVOR\fR: . .IP "" 4 . .nf The flavor of server . .fi . .IP "" 0 . .TP \fB\-i\fR, \fB\-\-image IMAGE\fR The image of the server . .TP \fB\-N\fR, \fB\-\-server\-name NAME\fR The server name . .TP \fB\-K\fR, \fB\-\-slicehost\-password PASSWORD\fR Your slicehost API password . .P Creates a new slicehost server\. . .P \fBslicehost server list\fR\fI(options)\fR . .P Lists running Slicehost servers\. . .P \fBslicehost server delete SLICENAME\fR . .P Deletes a running Slicehost server\. . .P \fBslicehost images list\fR . .P Lists the available Slicehost server images to boot\. . .SH "TERREMARK SUB\-COMMANDS" As above, Chef can also be used on Terremark vCloud nodes\. The following sub\-commands allow manipulating Terremark vCloud nodes via the \fBfog\fR library\. . .P \fBterremark server create NAME [RUN LIST\.\.\.]\fR\fI(options)\fR . .TP \fB\-K PASSWORD\fR, \fB\-\-terremark\-password\fR Your terremark password . .TP \fB\-S\fR, \fB\-\-terremark\-service SERVICE\fR Your terremark service name . .TP \fB\-A USERNAME\fR, \fB\-\-terremark\-username\fR Your terremark username . .P Creates a new Terremark vCloud server\. . .P \fBterremark server delete SERVER\fR\fI(options)\fR . .P Deletes a running Terremark vCloud server\. . .P \fBterremark server list\fR\fI(options)\fR . .TP \fB\-K PASSWORD\fR, \fB\-\-terremark\-password\fR Your terremark password . .TP \fB\-S\fR, \fB\-\-terremark\-service SERVICE\fR Your terremark service name . .TP \fB\-A USERNAME\fR, \fB\-\-terremark\-username\fR Your terremark username . .P Lists running Terremark vCloud servers\. . .SH "CONFIGURATION" The knife configuration file is a Ruby DSL to set configuration parameters for Knife\'s \fBGENERAL OPTIONS\fR\. The default location for the config file is \fB~/\.chef/knife\.rb\fR\. If managing multiple Chef repositories, per\-repository config files can be created\. The file must be \fB\.chef/knife\.rb\fR in the current directory of the repository\. . .P If the config file exists, knife uses these settings for \fBGENERAL OPTIONS\fR defaults\. . .P \fBlog_level\fR . .P A Ruby symbol specifying the log level\. Corresponds to \fB\-l\fR or \fB\-\-log_level\fR option\. Default is \fI:info\fR\. Valid values are: . .IP "\(bu" 4 :info . .IP "\(bu" 4 :debug . .IP "\(bu" 4 :warn . .IP "\(bu" 4 :fatal . .IP "" 0 . .P \fBlog_location\fR . .P Corresponds to the \fB\-L\fR or \fB\-\-log\-file\fR option\. Defaults is \fBSTDOUT\fR\. Valid values are \fBSTDOUT\fR or a filename\. . .P \fBnode_name\fR . .P User to authenticate to the Chef server\. Corresponds to the \fB\-u\fR or \fB\-\-user\fR option\. This is requested from the user when running this sub\-command\. . .P \fBclient_key\fR . .P Private key file to authenticate to the Chef server\. Corresponds to the \fB\-k\fR or \fB\-\-key\fR option\. This is requested from the user when running this sub\-command\. . .P \fBchef_server_url\fR . .P URL of the Chef server\. Corresponds to the \fB\-s\fR or \fB\-\-server\-url\fR option\. This is requested from the user when running this sub\-command\. . .P \fBcache_type\fR . .P The type of cache to use\. Default is BasicFile\. This can be any type of Cache that moneta supports: BasicFile, Berkeley, Couch, DataMapper, File, LMC, Memcache, Memory, MongoDB, Redis, Rufus, S3, SDBM, Tyrant, Xattr, YAML\. . .P \fBcache_options\fR . .P Specifies various options to use for caching\. Default reads the Chef client configuration (/etc/chef/checksums)\. . .P \fBvalidation_client_name\fR . .P Specifies the name of the client used to validate new clients\. This is requested from the user when running the configuration sub\-command\. . .P \fBvalidation_key\fR . .P Specifies the private key file to use for generating ec2 instance data for validating new clients\. This is implied from the \fBvalidation_client_name\fR\. . .P \fBcookbook_copyright\fR\fBcookbook_email\fR\fBcookbook_license\fR . .P Used by \fBknife cookbook create\fR sub\-command to specify the copyright holder, maintainer email and license (respectively) for new cookbooks\. The copyright holder is listed as the maintainer in the cookbook\'s metadata and as the Copyright in the comments of the default recipe\. The maintainer email is used in the cookbook metadata\. The license determines what preamble to put in the comment of the default recipe, and is listed as the license in the cookbook metadata\. Currently supported licenses are \"apachev2\" and \"none\"\. Any other values will result in an empty license in the metadata (needs to be filled in by the author), and no comment preamble in the default recipe\. . .P \fBknife[:aws_access_key_id]\fR\fBknife[:aws_secret_access_key]\fR . .P Specifies the Amazon AWS EC2 credentials to use when running the ec2 sub\-commands\. . .P \fBknife[:rackspace_api_username]\fR\fBknife[:rackspace_api_key]\fR . .P Specifies the Rackspace Cloud credentials to use when running the rackspace sub\-commands\. . .P \fBknife[:terremark_username]\fR\fBknife[:terremark_password]\fR\fBknife[:terremark_service]\fR . .P Specifies the Terremark vCloud credentials to use when running the terremark sub\-commands\. . .P \fBknife[:slicehost_password]\fR . .P Specifies the Slicehost password to use when running the slicdehost sub\-commands\. . .SH "FILES" \fI~/\.chef/knife\.rb\fR . .P Ruby DSL configuration file for knife\. See \fBCONFIGURATION\fR\. . .SH "CHEF WORKFLOW" When working with Chef and Knife in the local repository, the recommended workflow outline looks like: . .IP "\(bu" 4 Create repository\. A skeleton sample is provided at \fIhttp://github\.com/opscode/chef\-repo/\fR\. . .IP "\(bu" 4 Configure knife, see \fBCONFIGURATION\fR\. . .IP "\(bu" 4 Download cookbooks from the Opscode cookbooks site, see \fBCOOKBOOK SITE SUB\-COMMANDS\fR\. . .IP "\(bu" 4 Or, create new cookbooks, see \fBcookbook create\fR sub\-command\. . .IP "\(bu" 4 Commit changes to the version control system\. See your tool\'s documentation\. . .IP "\(bu" 4 Upload cookbooks to the Chef Server, see \fBCOOKBOOK SUB\-COMMANDS\fR\. . .IP "\(bu" 4 Launch instances in the Cloud, OR provision new hosts; see \fBCLOUD COMPUTING SUB\-COMMANDS\fR and \fBBOOTSTRAP SUB\-COMMANDS\fR\. . .IP "\(bu" 4 Watch Chef configure systems! . .IP "" 0 . .P A note about git: Opscode and many folks in the Chef community use git, but it is not required, except in the case of the \fBcookbook site vendor\fR sub\-command, as it uses git directly\. Version control is strongly recommended though, and git fits with a lot of the workflow paradigms\. . .SH "EXAMPLES" Example client config (\fB/etc/chef/client\.rb\fR) from \fBknife configure client\fR\. The same configuration is used when using the \fBknife bootstrap\fR command with the default \fBgem\fR templates that come with Chef\. . .IP "" 4 . .nf log_level :info log_location STDOUT chef_server_url \'https://api\.opscode\.com/organizations/ORGNAME\' validation_client_name \'ORGNAME\-validator\' . .fi . .IP "" 0 . .P Setting up a custom bootstrap is fairly straightforward\. Create \fB\.chef/bootstrap\fR in your Chef Repository directory or in \fB$HOME/\.chef/bootstrap\fR\. Then create the ERB template file\. . .IP "" 4 . .nf mkdir ~/\.chef/bootstrap vi ~/\.chef/bootstrap/debian5\.0\-apt\.erb . .fi . .IP "" 0 . .P For example, to create a new bootstrap template that should be used when setting up a new Debian node\. Edit the template to run the commands, set up the validation certificate and the client configuration file, and finally to run chef\-client on completion\. The bootstrap template can be called with: . .IP "" 4 . .nf knife bootstrap mynode\.example\.com \-\-template\-file ~/\.chef/bootstrap/debian5\.0\-apt\.erb . .fi . .IP "" 0 . .P Or, . .IP "" 4 . .nf knife bootstrap mynode\.example\.com \-\-distro debian5\.0\-apt . .fi . .IP "" 0 . .P The \fB\-\-distro\fR parameter will automatically look in the \fB~/\.chef/bootstrap\fR directory for a file named \fBdebian5\.0\-apt\.erb\fR\. . .P Templates provided by the Chef installation are located in \fBBASEDIR/lib/chef/knife/bootstrap/*\.erb\fR, where \fIBASEDIR\fR is the location where the package or Gem installed the Chef client libraries\. . .P Uploading cookbooks to the Opscode cookbooks site using the user/certificate specifically: . .IP "" 4 . .nf knife cookbook site share example Other \-k ~/\.chef/USERNAME\.pem \-u USERNAME . .fi . .IP "" 0 . .SH "SEE ALSO" Full documentation for Chef is located on the Chef wiki, http://wiki\.opscode\.com/display/chef/Home/\. . .P JSON is JavaScript Object Notation and more information can be found at http://json\.org/\. . .P SOLR is an open source search engine\. The Chef Server includes a SOLR installation\. More information about SOLR, including the search query syntax, can be found at http://lucene\.apache\.org/solr/\. . .P Git is a version control system and documented at http://git\-scm\.com/\. . .P This manual page was generated in nroff from Markdown with ronn\. Ryan Tomayko wrote ronn and more information can be found at http://rtomayko\.github\.com/ronn/ronn\.5\.html\. . .SH "AUTHOR" Chef was written by Adam Jacob \fIadam@opscode\.com\fR of Opscode (http://www\.opscode\.com), with contributions from the community\. This manual page was written by Joshua Timberman \fIjoshua@opscode\.com\fR\. Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2\.0 License\. . .P On Debian systems, the complete text of the Apache 2\.0 License can be found in \fB/usr/share/common\-licenses/Apache\-2\.0\fR\.