summaryrefslogtreecommitdiff
path: root/distro/common/man/man1/knife.1
blob: 9259da8477f7289f011ee983f38c290fe2432b06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
.\" 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.
.