summaryrefslogtreecommitdiff
path: root/chef/distro/common/html/knife.1.html
blob: b5c1d4d2a8765d9f3ae5d7b6e01f866a00510f2a (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
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv='content-type' value='text/html;charset=utf8'>
  <meta name='generator' value='Ronn/v0.7.3 (http://github.com/rtomayko/ronn/tree/0.7.3)'>
  <title>knife(1) - Chef Server REST API utility</title>
  <style type='text/css' media='all'>
  /* style: man */
  body#manpage {margin:0}
  .mp {max-width:100ex;padding:0 9ex 1ex 4ex}
  .mp p,.mp pre,.mp ul,.mp ol,.mp dl {margin:0 0 20px 0}
  .mp h2 {margin:10px 0 0 0}
  .mp > p,.mp > pre,.mp > ul,.mp > ol,.mp > dl {margin-left:8ex}
  .mp h3 {margin:0 0 0 4ex}
  .mp dt {margin:0;clear:left}
  .mp dt.flush {float:left;width:8ex}
  .mp dd {margin:0 0 0 9ex}
  .mp h1,.mp h2,.mp h3,.mp h4 {clear:left}
  .mp pre {margin-bottom:20px}
  .mp pre+h2,.mp pre+h3 {margin-top:22px}
  .mp h2+pre,.mp h3+pre {margin-top:5px}
  .mp img {display:block;margin:auto}
  .mp h1.man-title {display:none}
  .mp,.mp code,.mp pre,.mp tt,.mp kbd,.mp samp,.mp h3,.mp h4 {font-family:monospace;font-size:14px;line-height:1.42857142857143}
  .mp h2 {font-size:16px;line-height:1.25}
  .mp h1 {font-size:20px;line-height:2}
  .mp {text-align:justify;background:#fff}
  .mp,.mp code,.mp pre,.mp pre code,.mp tt,.mp kbd,.mp samp {color:#131211}
  .mp h1,.mp h2,.mp h3,.mp h4 {color:#030201}
  .mp u {text-decoration:underline}
  .mp code,.mp strong,.mp b {font-weight:bold;color:#131211}
  .mp em,.mp var {font-style:italic;color:#232221;text-decoration:none}
  .mp a,.mp a:link,.mp a:hover,.mp a code,.mp a pre,.mp a tt,.mp a kbd,.mp a samp {color:#0000ff}
  .mp b.man-ref {font-weight:normal;color:#434241}
  .mp pre {padding:0 4ex}
  .mp pre code {font-weight:normal;color:#434241}
  .mp h2+pre,h3+pre {padding-left:0}
  ol.man-decor,ol.man-decor li {margin:3px 0 10px 0;padding:0;float:left;width:33%;list-style-type:none;text-transform:uppercase;color:#999;letter-spacing:1px}
  ol.man-decor {width:100%}
  ol.man-decor li.tl {text-align:left}
  ol.man-decor li.tc {text-align:center;letter-spacing:4px}
  ol.man-decor li.tr {text-align:right;float:right}
  </style>
  <style type='text/css' media='all'>
  /* style: toc */
  .man-navigation {display:block !important;position:fixed;top:0;left:113ex;height:100%;width:100%;padding:48px 0 0 0;border-left:1px solid #dbdbdb;background:#eee}
  .man-navigation a,.man-navigation a:hover,.man-navigation a:link,.man-navigation a:visited {display:block;margin:0;padding:5px 2px 5px 30px;color:#999;text-decoration:none}
  .man-navigation a:hover {color:#111;text-decoration:underline}
  </style>
</head>
<!--
  The following styles are deprecated and will be removed at some point:
  div#man, div#man ol.man, div#man ol.head, div#man ol.man.

  The .man-page, .man-decor, .man-head, .man-foot, .man-title, and
  .man-navigation should be used instead.
-->
<body id='manpage'>
  <div class='mp' id='man'>

  <div class='man-navigation' style='display:none'>
    <a href="#NAME">NAME</a>
    <a href="#SYNOPSIS">SYNOPSIS</a>
    <a href="#DESCRIPTION">DESCRIPTION</a>
    <a href="#GENERAL-OPTIONS">GENERAL OPTIONS</a>
    <a href="#SUB-COMMANDS">SUB-COMMANDS</a>
    <a href="#GENERAL-SUB-COMMANDS">GENERAL SUB-COMMANDS</a>
    <a href="#CONFIGURATION">CONFIGURATION</a>
    <a href="#FILES">FILES</a>
    <a href="#CHEF-WORKFLOW">CHEF WORKFLOW</a>
    <a href="#EXAMPLES">EXAMPLES</a>
    <a href="#ENVIRONMENT">ENVIRONMENT</a>
    <a href="#SEE-ALSO">SEE ALSO</a>
    <a href="#AUTHOR">AUTHOR</a>
  </div>

  <ol class='man-decor man-head man head'>
    <li class='tl'>knife(1)</li>
    <li class='tc'>Chef Manual</li>
    <li class='tr'>knife(1)</li>
  </ol>

  <h2 id="NAME">NAME</h2>
<p class="man-name">
  <code>knife</code> - <span class="man-whatis">Chef Server REST API utility</span>
</p>

<h2 id="SYNOPSIS">SYNOPSIS</h2>

<p><strong>knife</strong> <em>sub-command</em> <em>(options)</em></p>

<h2 id="DESCRIPTION">DESCRIPTION</h2>

<p>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>

<p>Unless otherwise specified, output is in JSON format, and input files
are also JSON format.</p>

<p>The Chef class <code>Chef::Config</code> that configures the behavior of how knife
runs has options that correspond to command-line options. These are
noted as <code>Chef::Config</code> values.</p>

<h2 id="GENERAL-OPTIONS">GENERAL OPTIONS</h2>

<dl>
<dt><code>-s</code>, <code>--server-url</code> URL</dt><dd>Chef Server URL, corresponds to <code>Chef::Config</code> <code>chef_server_url</code>.</dd>
<dt><code>-k</code>, <code>--key</code> KEY</dt><dd>API Client Key, corresponds to <code>Chef::Config</code> <code>client_key</code>.</dd>
<dt><code>-c</code>, <code>--config</code> CONFIG</dt><dd>The configuration file to use</dd>
<dt><code>-e</code>, <code>--editor</code> EDITOR</dt><dd>Set the editor to use for interactive commands</dd>
<dt><code>-F</code>, <code>--format</code> FORMAT</dt><dd>Which format to use for output</dd>
<dt><code>-l</code>, <code>--log_level</code> LEVEL</dt><dd>Set the log level (debug, info, warn, error, fatal), corresponds to <code>Chef::Config</code> <code>log_level</code>.</dd>
<dt><code>-L</code>, <code>--logfile</code> LOGLOCATION</dt><dd>Set the log file location, defaults to STDOUT, corresponds to <code>Chef::Config</code> <code>log_location</code>.</dd>
<dt><code>-n</code>, <code>--no-editor</code></dt><dd>Do not open EDITOR, just accept the data as is</dd>
<dt><code>-u</code>, <code>--user</code> USER</dt><dd>API Client Username, corresponds to <code>Chef::Config</code> <code>node_name</code>.</dd>
<dt><code>-p</code>, <code>--print-after</code></dt><dd>Show the data after a destructive operation</dd>
<dt><code>-v</code>, <code>--version</code></dt><dd>Show chef version</dd>
<dt><code>-y</code>, <code>--yes</code></dt><dd>Say yes to all prompts for confirmation</dd>
<dt><code>-h</code>, <code>--help</code></dt><dd>Show this message</dd>
</dl>


<p>Usage information for sub-commands can be displayed with <code>knife SUB-COMMAND --help</code>.</p>

<h2 id="SUB-COMMANDS">SUB-COMMANDS</h2>

<p>Knife sub-commands are structured as <em>NOUN verb NOUN (options)</em>. The
sub-commands are meant to be intuitively named. Because the Chef Server
API is RESTful, sub-commands generally utilize CRUD operations.</p>

<ul>
<li>create (create)</li>
<li>list and show (read)</li>
<li>edit (update)</li>
<li>delete (destroy)</li>
</ul>


<p>Objects stored on the server support these, as described below.</p>

<h2 id="GENERAL-SUB-COMMANDS">GENERAL SUB-COMMANDS</h2>

<p><strong>recipe list [PATTERN]</strong></p>

<p>List available recipes from the server. Specify <em>PATTERN</em> as a regular expression to limit the results.</p>

<h2 id="CONFIGURATION">CONFIGURATION</h2>

<p>The knife configuration file is a Ruby DSL to set configuration
parameters for Knife's <strong>GENERAL OPTIONS</strong>. The default location for the
config file is <code>~/.chef/knife.rb</code>. If managing multiple Chef
repositories, per-repository config files can be created. The file must
be <code>.chef/knife.rb</code> in the current directory of the repository.</p>

<p>If the config file exists, knife uses these settings for <strong>GENERAL OPTIONS</strong> defaults.</p>

<p><code>log_level</code></p>

<p>A Ruby symbol specifying the log level. Corresponds to <code>-l</code> or <code>--log_level</code> option. Default is <em>:info</em>. Valid values are:</p>

<ul>
<li>:info</li>
<li>:debug</li>
<li>:warn</li>
<li>:fatal</li>
</ul>


<p><code>log_location</code></p>

<p>Corresponds to the <code>-L</code> or <code>--log-file</code> option. Defaults is <strong>STDOUT</strong>.
Valid values are <strong>STDOUT</strong> or a filename.</p>

<p><code>node_name</code></p>

<p>User to authenticate to the Chef server. Corresponds to the <code>-u</code> or
<code>--user</code> option. This is requested from the user when running this
sub-command.</p>

<p><code>client_key</code></p>

<p>Private key file to authenticate to the Chef server. Corresponds to the
<code>-k</code> or <code>--key</code> option. This is requested from the user when running
this sub-command.</p>

<p><code>chef_server_url</code></p>

<p>URL of the Chef server. Corresponds to the <code>-s</code> or <code>--server-url</code>
option. This is requested from the user when running this sub-command.</p>

<p><code>cache_type</code></p>

<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>

<p><code>cache_options</code></p>

<p>Specifies various options to use for caching. Default reads the Chef
client configuration (/etc/chef/checksums).</p>

<p><code>validation_client_name</code></p>

<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>

<p><code>validation_key</code></p>

<p>Specifies the private key file to use for generating ec2 instance data
for validating new clients. This is implied from the
<code>validation_client_name</code>.</p>

<p><code>cookbook_copyright</code>
<code>cookbook_email</code>
<code>cookbook_license</code></p>

<p>Used by <code>knife cookbook create</code> 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>

<p><code>knife[:aws_access_key_id]</code>
<code>knife[:aws_secret_access_key]</code></p>

<p>Specifies the Amazon AWS EC2 credentials to use when running the ec2 sub-commands.</p>

<p><code>knife[:rackspace_api_username]</code>
<code>knife[:rackspace_api_key]</code></p>

<p>Specifies the Rackspace Cloud credentials to use when running the rackspace sub-commands.</p>

<p><code>knife[:terremark_username]</code>
<code>knife[:terremark_password]</code>
<code>knife[:terremark_service]</code></p>

<p>Specifies the Terremark vCloud credentials to use when running the terremark sub-commands.</p>

<p><code>knife[:slicehost_password]</code></p>

<p>Specifies the Slicehost password to use when running the slicdehost sub-commands.</p>

<h2 id="FILES">FILES</h2>

<p><em>~/.chef/knife.rb</em></p>

<p>Ruby DSL configuration file for knife. See <strong>CONFIGURATION</strong>.</p>

<h2 id="CHEF-WORKFLOW">CHEF WORKFLOW</h2>

<p>When working with Chef and Knife in the local repository, the recommended workflow outline looks like:</p>

<ul>
<li>Create repository. A skeleton sample is provided at <em>http://github.com/opscode/chef-repo/</em>.</li>
<li>Configure knife, see <strong>CONFIGURATION</strong>.</li>
<li>Download cookbooks from the Opscode cookbooks site, see <strong>COOKBOOK SITE SUB-COMMANDS</strong>.</li>
<li>Or, create new cookbooks, see <code>cookbook create</code> sub-command.</li>
<li>Commit changes to the version control system. See your tool's documentation.</li>
<li>Upload cookbooks to the Chef Server, see <strong>COOKBOOK SUB-COMMANDS</strong>.</li>
<li>Launch instances in the Cloud, OR provision new hosts; see <strong>CLOUD COMPUTING SUB-COMMANDS</strong> and <strong>BOOTSTRAP SUB-COMMANDS</strong>.</li>
<li>Watch Chef configure systems!</li>
</ul>


<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 <code>cookbook site vendor</code>
sub-command, as it uses git directly. Version control is strongly
recommended though, and git fits with a lot of the workflow paradigms.</p>

<h2 id="EXAMPLES">EXAMPLES</h2>

<p>Example client config (<code>/etc/chef/client.rb</code>) from <code>knife configure
client</code>. The same configuration is used when using the <code>knife bootstrap</code>
command with the default <code>gem</code> templates that come with Chef.</p>

<pre><code>log_level        :info
log_location     STDOUT
chef_server_url  'https://api.opscode.com/organizations/ORGNAME'
validation_client_name 'ORGNAME-validator'
</code></pre>

<p>Setting up a custom bootstrap is fairly straightforward. Create
<code>.chef/bootstrap</code> in your Chef Repository directory or in
<code>$HOME/.chef/bootstrap</code>. Then create the ERB template file.</p>

<pre><code>mkdir ~/.chef/bootstrap
vi ~/.chef/bootstrap/debian5.0-apt.erb
</code></pre>

<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:</p>

<pre><code>knife bootstrap mynode.example.com --template-file ~/.chef/bootstrap/debian5.0-apt.erb
</code></pre>

<p>Or,</p>

<pre><code>knife bootstrap mynode.example.com --distro debian5.0-apt
</code></pre>

<p>The <code>--distro</code> parameter will automatically look in the
<code>~/.chef/bootstrap</code> directory for a file named <code>debian5.0-apt.erb</code>.</p>

<p>Templates provided by the Chef installation are located in
<code>BASEDIR/lib/chef/knife/bootstrap/*.erb</code>, where <em>BASEDIR</em> is the
location where the package or Gem installed the Chef client libraries.</p>

<p>Uploading cookbooks to the Opscode cookbooks site using the user/certificate specifically:</p>

<pre><code>knife cookbook site share example Other -k ~/.chef/USERNAME.pem -u USERNAME
</code></pre>

<h2 id="ENVIRONMENT">ENVIRONMENT</h2>

<dl>
<dt class="flush"><code>EDITOR</code></dt><dd>The text editor to use for editing data. The --editor option takes
precedence over this value, and the --no-editor option supresses
data editing entirely.</dd>
</dl>


<h2 id="SEE-ALSO">SEE ALSO</h2>

<p>Full documentation for Chef is located on the Chef wiki, http://wiki.opscode.com/display/chef/Home/.</p>

<p>JSON is JavaScript Object Notation and more information can be found at http://json.org/.</p>

<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>

<p>Git is a version control system and documented at http://git-scm.com/.</p>

<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.</p>

<h2 id="AUTHOR">AUTHOR</h2>

<p>Chef was written by Adam Jacob <a href="&#109;&#97;&#105;&#108;&#x74;&#111;&#x3a;&#x61;&#100;&#97;&#109;&#x40;&#x6f;&#x70;&#115;&#x63;&#x6f;&#100;&#101;&#x2e;&#99;&#111;&#x6d;" data-bare-link="true">&#x61;&#x64;&#97;&#x6d;&#x40;&#x6f;&#x70;&#115;&#x63;&#x6f;&#100;&#x65;&#46;&#x63;&#x6f;&#x6d;</a> of Opscode (<a href="http://www.opscode.com" data-bare-link="true">http://www.opscode.com</a>), with contributions from the community. This manual page was written by Joshua Timberman <a href="&#x6d;&#x61;&#x69;&#108;&#116;&#x6f;&#58;&#106;&#111;&#115;&#104;&#117;&#x61;&#64;&#x6f;&#112;&#x73;&#x63;&#111;&#100;&#x65;&#x2e;&#99;&#111;&#x6d;" data-bare-link="true">&#x6a;&#111;&#x73;&#104;&#x75;&#x61;&#x40;&#111;&#112;&#x73;&#x63;&#x6f;&#x64;&#x65;&#46;&#99;&#x6f;&#109;</a>. Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License.</p>

<p>On Debian systems, the complete text of the Apache 2.0 License can be found in <code>/usr/share/common-licenses/Apache-2.0</code>.</p>


  <ol class='man-decor man-foot man foot'>
    <li class='tl'>Chef 0.10.0.beta.7</li>
    <li class='tc'>April 2011</li>
    <li class='tr'>knife(1)</li>
  </ol>

  </div>
</body>
</html>