.TH "KNIFE" "1" "Chef 11.8.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 .. .\" Man page generated from reStructuredText. . .sp Knife is a command\-line tool that provides an interface between a local chef\-repo and the 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 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 server and an organization\(aqs infrastructure. Knife interacts with a 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 Hosted Chef or Private Chef. Knife is configured during workstation setup, but subsequent modifications can be made using the knife.rb configuration file. .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: .sp .nf .ft C $ knife data bag edit admins admin_name .ft P .fi .sp will open up the text editor with data similar to: .sp .nf .ft C { "id": "admin_name" } .ft P .fi .sp Changes to that file can then be made: .sp .nf .ft C { "id": "Justin C." "description": "I am passing the time by letting time pass over me ..." } .ft P .fi .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: .sp .nf .ft C knife[:editor] = "/usr/bin/vim" .ft P .fi .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: .sp .nf .ft C C:\e\eProgram Files (x86)\eEditPad Pro\eEditPad.exe .ft P .fi .sp the setting in the knife.rb file would be similar to: .sp .nf .ft C knife[:editor] = "C:\e\eProgra~1\e\eEditPa~1\e\eEditPad.exe" .ft P .fi .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++: .sp .nf .ft C knife[:editor] = \(aq"C:\eProgram Files (x86)\eNotepad++\enotepad++.exe \-nosession \-multiInst"\(aq .ft P .fi .sp for Sublime Text: .sp .nf .ft C knife[:editor] = \(aq"C:\eProgram Files\eSublime Text 2\esublime_text.exe \-\-wait"\(aq .ft P .fi .sp for TextPad: .sp .nf .ft C knife[:editor] = \(aq"C:\eProgram Files (x86)\eTextPad 7\eTextPad.exe"\(aq .ft P .fi .sp and for vim: .sp .nf .ft C knife[:editor] = \(aq"C:\eProgram Files (x86)\evim\evim74\egvim.exe"\(aq .ft P .fi .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. .IP Note The following subcommands run only against the open source server: \fBindex rebuild\fP and \fBuser\fP. .RE .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. .IP Note 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. .RE .SH AUTHOR Opscode .\" Generated by docutils manpage writer. .