.\" Man page generated from reStructuredText. . .TH "KNIFE" "1" "Chef 12.0" "" "knife" .SH NAME knife \- The man page for the knife command line tool. . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .sp knife is a command\-line tool that provides an interface between a local chef\-repo and the Chef server\&. knife helps users to manage: .INDENT 0.0 .IP \(bu 2 Nodes .IP \(bu 2 Cookbooks and recipes .IP \(bu 2 Roles .IP \(bu 2 Stores of JSON data (data bags), including encrypted data .IP \(bu 2 Environments .IP \(bu 2 Cloud resources, including provisioning .IP \(bu 2 The installation of the chef\-client on management workstations .IP \(bu 2 Searching of indexed data on the Chef server .UNINDENT .sp Knife subcommands: .INDENT 0.0 .IP \(bu 2 knife bootstrap .IP \(bu 2 knife client .IP \(bu 2 knife configure .IP \(bu 2 knife cookbook .IP \(bu 2 knife cookbook site .IP \(bu 2 knife data bag .IP \(bu 2 knife delete .IP \(bu 2 knife deps .IP \(bu 2 knife diff .IP \(bu 2 knife download .IP \(bu 2 knife edit .IP \(bu 2 knife environment .IP \(bu 2 knife exec .IP \(bu 2 knife list .IP \(bu 2 knife node .IP \(bu 2 knife raw .IP \(bu 2 knife recipe list .IP \(bu 2 knife role .IP \(bu 2 knife search .IP \(bu 2 knife show .IP \(bu 2 knife ssh .IP \(bu 2 knife status .IP \(bu 2 knife tag .IP \(bu 2 knife upload .IP \(bu 2 knife user .IP \(bu 2 knife xargs .UNINDENT .SH WORKING WITH KNIFE .sp knife runs from a management workstation and sits in\-between a Chef server and an organization\(aqs infrastructure. knife interacts with a Chef server by using the same REST API that is used by a chef\-client\&. Role\-based authentication controls (RBAC) can be used to authorize changes when knife is run with Enterprise Chef\&. knife is configured during workstation setup, but subsequent modifications can be made using the knife.rb configuration file. .SS Common Options .sp The following options can be run with all knife sub\-commands and plug\-ins: .INDENT 0.0 .TP .B \fB\-c CONFIG_FILE\fP, \fB\-\-config CONFIG_FILE\fP The configuration file to use. For example, when knife is run from a node that is configured to be managed by the Chef server, this option is used to allow knife to use the same credentials as the chef\-client when communicating with the Chef server\&. .TP .B \fB\-\-chef\-zero\-port PORT\fP The port on which chef\-zero will listen. .TP .B \fB\-d\fP, \fB\-\-disable\-editing\fP Use to prevent the $EDITOR from being opened and to accept data as\-is. .TP .B \fB\-\-defaults\fP Use to have knife use the default value instead of asking a user to provide one. .TP .B \fB\-e EDITOR\fP, \fB\-\-editor EDITOR\fP The $EDITOR that is used for all interactive commands. .TP .B \fB\-E ENVIRONMENT\fP, \fB\-\-environment ENVIRONMENT\fP The name of the environment. When this option is added to a command, the command will run only against the named environment. This option is ignored during search queries made using the \fBknife search\fP subcommand. .TP .B \fB\-F FORMAT\fP, \fB\-\-format FORMAT\fP The output format: \fBsummary\fP (default), \fBtext\fP, \fBjson\fP, \fByaml\fP, and \fBpp\fP\&. .TP .B \fB\-h\fP, \fB\-\-help\fP Shows help for the command. .TP .B \fB\-k KEY\fP, \fB\-\-key KEY\fP The private key that knife will use to sign requests made by the API client to the Chef server\&. .TP .B \fB\-\-[no\-]color\fP Use to view colored output. .TP .B \fB\-\-print\-after\fP Use to show data after a destructive operation. .TP .B \fB\-s URL\fP, \fB\-\-server\-url URL\fP The URL for the Chef server\&. .TP .B \fB\-u USER\fP, \fB\-\-user USER\fP The user name used by knife to sign requests made by the API client to the Chef server\&. Authentication will fail if the user name does not match the private key. .TP .B \fB\-v\fP, \fB\-\-version\fP The version of the chef\-client\&. .TP .B \fB\-V\fP, \fB\-\-verbose\fP Set for more verbose outputs. Use \fB\-VV\fP for maximum verbosity. .TP .B \fB\-y\fP, \fB\-\-yes\fP Use to respond to all confirmation prompts with "Yes". knife will not ask for confirmation. .TP .B \fB\-z\fP, \fB\-\-local\-mode\fP Use to run the chef\-client in local mode. This allows all commands that work against the Chef server to also work against the local chef\-repo\&. .UNINDENT .SS JSON Data Format .sp Most data is entered using a text editor in JSON format, unless the \fB\-\-disable\-editing\fP option is entered as part of a command. (Encrypted data bags use YAML, which is a superset of JSON\&.) JSON is a common, language\-independent data format that provides a simple text representation of arbitrary data structures. For more information about JSON, see \fI\%http://www.json.org/\fP or \fI\%http://en.wikipedia.org/wiki/JSON\fP\&. .SS Set the Text Editor .sp Some knife commands, such as \fBknife data bag edit\fP, require that information be edited as JSON data using a text editor. For example, the following command: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C $ knife data bag edit admins admin_name .ft P .fi .UNINDENT .UNINDENT .sp will open up the text editor with data similar to: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C { "id": "admin_name" } .ft P .fi .UNINDENT .UNINDENT .sp Changes to that file can then be made: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C { "id": "Justin C." "description": "I am passing the time by letting time pass over me ..." } .ft P .fi .UNINDENT .UNINDENT .sp The type of text editor that is used by knife can be configured by adding an entry to the knife.rb file or by setting an \fBEDITOR\fP environment variable. For example, to configure the text editor to always open with vim, add the following to the knife.rb file: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C knife[:editor] = "/usr/bin/vim" .ft P .fi .UNINDENT .UNINDENT .sp When a Microsoft Windows file path is enclosed in a double\-quoted string (" "), the same backslash character (\fB\e\fP) that is used to define the file path separator is also used in Ruby to define an escape character. The knife.rb file is a Ruby file; therefore, file path separators must be escaped. In addition, spaces in the file path must be replaced with \fB~1\fP so that the length of each section within the file path is not more than 8 characters. For example, if EditPad Pro is the text editor of choice and is located at the following path: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C C:\e\eProgram Files (x86)\eEditPad Pro\eEditPad.exe .ft P .fi .UNINDENT .UNINDENT .sp the setting in the knife.rb file would be similar to: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C knife[:editor] = "C:\e\eProgra~1\e\eEditPa~1\e\eEditPad.exe" .ft P .fi .UNINDENT .UNINDENT .sp One approach to working around the double\- vs. single\-quote issue is to put the single\-quotes outside of the double\-quotes. For example, for Notepad++: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C knife[:editor] = \(aq"C:\eProgram Files (x86)\eNotepad++\enotepad++.exe \-nosession \-multiInst"\(aq .ft P .fi .UNINDENT .UNINDENT .sp for Sublime Text: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C knife[:editor] = \(aq"C:\eProgram Files\eSublime Text 2\esublime_text.exe \-\-wait"\(aq .ft P .fi .UNINDENT .UNINDENT .sp for TextPad: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C knife[:editor] = \(aq"C:\eProgram Files (x86)\eTextPad 7\eTextPad.exe"\(aq .ft P .fi .UNINDENT .UNINDENT .sp and for vim: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C knife[:editor] = \(aq"C:\eProgram Files (x86)\evim\evim74\egvim.exe"\(aq .ft P .fi .UNINDENT .UNINDENT .SS Using Quotes .sp Values can be entered with double quotes (" ") or single quotes (\(aq \(aq), but this should be done consistently. .SS Sub\-commands .sp knife comes with a collection of built in subcommands that work together to provide all of the functionality required to take specific actions against any object in an organization, including cookbooks, nodes, roles, data bags, environments, and users. A knife plugin extends the functionality beyond built\-in subcommands. .sp knife has the following subcommands: \fBbootstrap\fP, \fBclient\fP, \fBconfigure\fP, \fBcookbook\fP, \fBcookbook site\fP, \fBdata bag\fP, \fBdelete\fP, \fBdeps\fP, \fBdiff\fP, \fBdownload\fP, \fBedit\fP, \fBenvironment\fP, \fBexec\fP, \fBindex rebuild\fP, \fBlist\fP, \fBnode\fP, \fBrecipe list\fP, \fBrole\fP, \fBsearch\fP, \fBshow\fP, \fBssh\fP, \fBstatus\fP, \fBtag\fP, \fBupload\fP, \fBuser\fP, and \fBxargs\fP\&. .sp \fBNOTE:\fP .INDENT 0.0 .INDENT 3.5 The following subcommands run only against the open source Chef server: \fBindex rebuild\fP and \fBuser\fP\&. .UNINDENT .UNINDENT .SS Syntax .sp All knife subcommands have the following syntax: .INDENT 0.0 .INDENT 3.5 knife subcommand [ARGUMENT] (options) .UNINDENT .UNINDENT .sp Each subcommand has its own set of arguments and options. .sp \fBNOTE:\fP .INDENT 0.0 .INDENT 3.5 All syntax examples in this document show variables in ALL_CAPS. For example \fB\-u PORT_LIST\fP (where PORT_LIST is a comma\-separated list of local and public UDP ports) or \fB\-F FORMAT\fP (where FORMAT determines the output format, either \fBsummary\fP, \fBtext\fP, \fBjson\fP, \fByaml\fP, or \fBpp\fP). These variables often require specific values that are unique to each organization. .UNINDENT .UNINDENT .SH AUTHOR Chef .\" Generated by docutils manpage writer. .