summaryrefslogtreecommitdiff
path: root/distro/common/man/man1/knife-cookbook.1
blob: 7e4c643f78541416f59efdf4d9fcf8233245cb10 (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
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
.TH "KNIFE-COOKBOOK" "1" "Chef 11.8.0" "" "knife cookbook"
.SH NAME
knife-cookbook \- The man page for the knife cookbook subcommand.
.
.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
A cookbook is the fundamental unit of configuration and policy distribution. Each cookbook defines a scenario, such as everything needed to install and configure MySQL, and then it contains all of the components that are required to support that scenario, including:
.INDENT 0.0
.IP \(bu 2
Attribute values that are set on nodes
.IP \(bu 2
Definitions that allow the creation of reusable collections of resources
.IP \(bu 2
File distributions
.IP \(bu 2
Libraries that extend the chef\-client and/or provide helpers to Ruby code
.IP \(bu 2
Recipes that specify which resources to manage and the order in which those resources will be applied
.IP \(bu 2
Custom resources and providers
.IP \(bu 2
Templates
.IP \(bu 2
Versions
.IP \(bu 2
Metadata about recipes (including dependencies), version constraints, supported platforms, and so on
.UNINDENT
.sp
The \fBknife cookbook\fP subcommand is used to interact with cookbooks that are located on the server or the local chef\-repo.
.sp
This subcommand has the following syntax:
.sp
.nf
.ft C
$ knife cookbook [ARGUMENT] (options)
.ft P
.fi
.SH COMMON OPTIONS
.sp
The following options may be used with any of the arguments available to the \fBknife cookbook\fP subcommand:
.INDENT 0.0
.TP
.B \fB\-\-chef\-zero\-port PORT\fP
The port on which chef\-zero will listen.
.TP
.B \fB\-c CONFIG_FILE\fP, \fB\-\-config CONFIG_FILE\fP
The configuration file to use.
.TP
.B \fB\-d\fP, \fB\-\-disable\-editing\fP
Indicates that $EDITOR will not be opened; data will be accepted as\-is.
.TP
.B \fB\-\-defaults\fP
Indicates that Knife will 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.
.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 server.
.TP
.B \fB\-\-[no\-]color\fP
Indicates whether colored output will be used.
.TP
.B \fB\-\-print\-after\fP
Indicates that data will be shown after a destructive operation.
.TP
.B \fB\-s URL\fP, \fB\-\-server\-url URL\fP
The URL for the 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 server. Authentication will fail if the user name does not match the private key.
.TP
.B \fB\-V\fP, \fB\-\-verbose\fP
Set for more verbose outputs. Use \fB\-VV\fP for maximum verbosity.
.TP
.B \fB\-v\fP, \fB\-\-version\fP
The version of the chef\-client.
.TP
.B \fB\-y\fP, \fB\-\-yes\fP
Indicates that the response to all confirmation prompts will be "Yes" (and that Knife will not ask for confirmation).
.TP
.B \fB\-z\fP, \fB\-\-local\-mode\fP
Indicates that the chef\-client will be run in local mode, which allows all commands that work against the server to also work against the local chef\-repo.
.UNINDENT
.SH BULK DELETE
.sp
The \fBbulk delete\fP argument is used to delete cookbook files that match a pattern defined by a regular expression. The regular expression must be within quotes and not be surrounded by forward slashes (/).
.sp
\fBSyntax\fP
.sp
This argument has the following syntax:
.sp
.nf
.ft C
$ knife cookbook bulk delete REGEX (options)
.ft P
.fi
.sp
\fBOptions\fP
.sp
This argument has the following options:
.INDENT 0.0
.TP
.B \fB\-p\fP, \fB\-\-purge\fP
Indicates that a cookbook (or cookbook version) will be removed entirely from the server. This action should be used carefully because only one copy of any single file is stored on the server. Consequently, purging a cookbook will disable any other cookbook that references one or more files from a cookbook that has been purged.
.UNINDENT
.sp
\fBExamples\fP
.sp
To bulk delete many cookbooks, use a regular expression to define the pattern:
.sp
.nf
.ft C
$ knife cookbook bulk delete "^[0\-9]{3}$" \-p
.ft P
.fi
.SH CREATE
.sp
The \fBcreate\fP argument is used to create a new cookbook directory on the local machine, including the following directories and files:
.INDENT 0.0
.INDENT 3.5
.INDENT 0.0
.IP \(bu 2
cookbook/attributes
.IP \(bu 2
cookbook/CHANGELOG.md
.IP \(bu 2
cookbook/definitions
.IP \(bu 2
cookbook/files/default
.IP \(bu 2
cookbook/libraries
.IP \(bu 2
cookbook/metadata.rb
.IP \(bu 2
cookbook/providers
.IP \(bu 2
cookbook/README.md (or .rdoc)
.IP \(bu 2
cookbook/recipes/default.rb
.IP \(bu 2
cookbook/resources
.IP \(bu 2
cookbook/templates/default
.UNINDENT
.UNINDENT
.UNINDENT
.sp
After the cookbook is created, it can be uploaded to the server using the \fBknife upload\fP argument.
.sp
\fBSyntax\fP
.sp
This argument has the following syntax:
.sp
.nf
.ft C
$ knife cookbook create COOKBOOK_NAME (options)
.ft P
.fi
.sp
\fBOptions\fP
.sp
This argument has the following options:
.INDENT 0.0
.TP
.B \fB\-C COPYRIGHT_HOLDER\fP, \fB\-\-copyright COPYRIGHT_HOLDER\fP
The name of the copyright holder. This option will place a copyright notice that contains the name of the copyright holder in each of the pre\-created files. If this option is not specified, a copyright name of "your_company_name" will be used instead; it can be easily modified later.
.TP
.B \fB\-I LICENSE\fP, \fB\-\-license LICENSE\fP
The type of license under which a cookbook is distributed: \fBapachev2\fP, \fBgplv2\fP, \fBgplv3\fP, \fBmit\fP, or \fBnone\fP (default). This option will place the appropriate license notice in the pre\-created files: \fBApache v2.0\fP (for \fBapachev2\fP), \fBGPL v2\fP (for \fBgplv2\fP), \fBGPL v3\fP (for \fBgplv3\fP), \fBMIT\fP (for \fBmit\fP), or \fBlicense \(aqProprietary \- All Rights Reserved\fP (for \fBnone\fP). Be aware of the licenses for files inside of a cookbook and be sure to follow any restrictions they describe.
.TP
.B \fB\-m EMAIL\fP, \fB\-\-email EMAIL\fP
The email address for the individual who maintains the cookbook. This option will place an email address in each of the pre\-created files. If this option is not specified, an email name of "your_email" will be used instead; it can be easily modified later.
.TP
.B \fB\-o PATH\fP, \fB\-\-cookbook\-path PATH\fP
The directory in which cookbook are created. This can be a colon\-separated path.
.TP
.B \fB\-r FORMAT\fP, \fB\-\-readme\-format FORMAT\fP
The document format of the readme file: \fBmd\fP (markdown) and \fBrdoc\fP (Ruby docs).
.UNINDENT
.sp
\fBExamples\fP
.sp
To create a cookbook named "my_cookbook" with copyright, email, license, and readme format options specified, enter:
.sp
.nf
.ft C
$ knife cookbook create my_cookbook \-C "My Name" \-m "my@email.com" \-I apachev2 \-r md
.ft P
.fi
.sp
to return something like:
.sp
.nf
.ft C
** Creating cookbook my_cookbook
** Creating README for cookbook: my_cookbook
** Creating metadata for cookbook: my_cookbook
.ft P
.fi
.SH DELETE
.sp
The \fBdelete\fP argument is used to delete a specified cookbook or cookbook version on the server (and not locally).
.sp
\fBSyntax\fP
.sp
This argument has the following syntax:
.sp
.nf
.ft C
$ knife cookbook delete COOKBOOK_NAME [COOKBOOK_VERSION] (options)
.ft P
.fi
.sp
\fBOptions\fP
.sp
This argument has the following options:
.INDENT 0.0
.TP
.B \fB\-a\fP, \fB\-\-all\fP
Indicates that a cookbook and every version of that cookbook will be deleted.
.TP
.B \fBCOOKBOOK_VERSION\fP
The version of a cookbook to be deleted. If a cookbook has only one version, this option does not need to be specified. If a cookbook has more than one version and this option is not specified, Knife will prompt for a version.
.TP
.B \fB\-p\fP, \fB\-\-purge\fP
Indicates that a cookbook (or cookbook version) will be removed entirely from the server. This action should be used carefully because only one copy of any single file is stored on the server. Consequently, purging a cookbook will disable any other cookbook that references one or more files from a cookbook that has been purged.
.UNINDENT
.sp
\fBExamples\fP
.sp
To delete version "0.8" from a cookbook named "smartmon", enter:
.sp
.nf
.ft C
$ knife cookbook delete smartmon 0.8
.ft P
.fi
.sp
Type \fBY\fP to confirm a deletion.
.SH DOWNLOAD
.sp
The \fBdownload\fP argument is used to download a cookbook from the server to the current working directory.
.sp
\fBSyntax\fP
.sp
This argument has the following syntax:
.sp
.nf
.ft C
$ knife cookbook download COOKBOOK_NAME [COOKBOOK_VERSION] (options)
.ft P
.fi
.sp
\fBOptions\fP
.sp
This argument has the following options:
.INDENT 0.0
.TP
.B \fB\-d DOWNLOAD_DIRECTORY\fP, \fB\-\-dir DOWNLOAD_DIRECTORY\fP
The directory into which a cookbook will be downloaded.
.TP
.B \fB\-f\fP, \fB\-\-force\fP
Indicates that an existing directory will be overwritten.
.TP
.B \fB\-N\fP, \fB\-\-latest\fP
Indicates that the most recent version of a cookbook will be downloaded.
.UNINDENT
.sp
\fBExamples\fP
.sp
To download a cookbook named "smartmon", enter:
.sp
.nf
.ft C
$ knife cookbook download smartmon
.ft P
.fi
.SH LIST
.sp
The \fBlist\fP argument is used to view a list of cookbooks that are currently available on the server. The list will contain only the most recent version for each cookbook by default.
.sp
\fBSyntax\fP
.sp
This argument has the following syntax:
.sp
.nf
.ft C
$ knife cookbook list (options)
.ft P
.fi
.sp
\fBOptions\fP
.sp
This argument has the following options:
.INDENT 0.0
.TP
.B \fB\-a\fP, \fB\-\-all\fP
Indicates that all available versions of each cookbook will be returned.
.TP
.B \fB\-w\fP, \fB\-\-with\-uri\fP
Indicates that the corresponding URIs will be shown.
.UNINDENT
.sp
\fBExamples\fP
.sp
To view a list of cookbooks:
.sp
.nf
.ft C
$ knife cookbook list
.ft P
.fi
.SH METADATA
.sp
The \fBmetadata\fP argument is used to generate the metadata for one or more cookbooks.
.sp
\fBSyntax\fP
.sp
This argument has the following syntax:
.sp
.nf
.ft C
$ knife cookbook metadata (options)
.ft P
.fi
.sp
\fBOptions\fP
.sp
This argument has the following options:
.INDENT 0.0
.TP
.B \fB\-a\fP, \fB\-\-all\fP
Indicates that metadata should be generated for all cookbooks, and not just for a specified cookbook.
.TP
.B \fB\-o PATH:PATH\fP, \fB\-\-cookbook\-path PATH:PATH\fP
The directory in which cookbook are created. This can be a colon\-separated path.
.UNINDENT
.sp
\fBExamples\fP
.sp
To generate metadata for all cookbooks:
.sp
.nf
.ft C
$ knife cookbook metadata \-a
.ft P
.fi
.SH METADATA FROM FILE
.sp
The \fBmetadata from file\fP argument is used to load the metadata for a cookbook from a file.
.sp
\fBSyntax\fP
.sp
This argument has the following syntax:
.sp
.nf
.ft C
$ knife cookbook metadata from file FILE
.ft P
.fi
.sp
\fBOptions\fP
.sp
This command does not have any specific options.
.sp
\fBExamples\fP
.sp
To view cookbook metadata from a JSON file:
.sp
.nf
.ft C
$ knife cookbook metadta from file /path/to/file
.ft P
.fi
.SH SHOW
.sp
The \fBshow\fP argument is used to view information about a cookbook, parts of a cookbook (attributes, definitions, files, libraries, providers, recipes, resources, and templates), or a file that is associated with a cookbook (including attributes such as checksum or specificity).
.sp
\fBSyntax\fP
.sp
This argument has the following syntax:
.sp
.nf
.ft C
$ knife cookbook show COOKBOOK_NAME [COOKBOOK_VERSION] [PART...] [FILE_NAME] (options)
.ft P
.fi
.sp
\fBOptions\fP
.sp
This argument has the following options:
.INDENT 0.0
.TP
.B \fBCOOKBOOK_VERSION\fP
The version of a cookbook to be shown. If a cookbook has only one version, this option does not need to be specified. If a cookbook has more than one version and this option is not specified, a list of cookbook versions will be returned.
.TP
.B \fB\-f FQDN\fP, \fB\-\-fqdn FQDN\fP
The FQDN of the host.
.TP
.B \fBFILE_NAME\fP
The name of a file that is associated with a cookbook.
.TP
.B \fB\-p PLATFORM\fP, \fB\-\-platform PLATFORM\fP
The platform for which a cookbook is designed.
.TP
.B \fBPART\fP
The part of the cookbook to show: \fBattributes\fP, \fBdefinitions\fP, \fBfiles\fP, \fBlibraries\fP, \fBproviders\fP, \fBrecipes\fP, \fBresources\fP, or \fBtemplates\fP. More than one part can be specified.
.TP
.B \fB\-V PLATFORM_VERSION\fP, \fB\-\-platform\-version PLATFORM_VERSION\fP
The version of the platform.
.TP
.B \fB\-w\fP, \fB\-\-with\-uri\fP
Indicates that the corresponding URIs will be shown.
.UNINDENT
.sp
\fBExamples\fP
.sp
To get the list of available versions of a cookbook named "getting\-started", enter:
.sp
.nf
.ft C
$ knife cookbook show getting\-started
.ft P
.fi
.sp
to return something like:
.sp
.nf
.ft C
getting\-started   0.3.0  0.2.0
.ft P
.fi
.sp
To show a list of data about a cookbook using the name of the cookbook and the version, enter:
.sp
.nf
.ft C
$ knife cookbook show getting\-started 0.3.0
.ft P
.fi
.sp
to return something like:
.sp
.nf
.ft C
attributes:
  checksum:     fa0fc4abf3f6787aeb5c3c5c35de667c
  name:         default.rb
  path:         attributes/default.rb
  specificity:  default
  url:          https://somelongurlhere.com
chef_type:      cookbook_version
cookbook_name:  getting\-started
definitions:    []
files:          []
frozen?:        false
json_class:     Chef::CookbookVersion
libraries:      []
.ft P
.fi
.sp
To only view data about "templates", enter:
.sp
.nf
.ft C
$ knife cookbook show getting\-started 0.3.0 templates
.ft P
.fi
.sp
to return something like:
.sp
.nf
.ft C
checksum:     a29d6f254577b830091f140c3a78b1fe
name:         chef\-getting\-started.txt.erb
path:         templates/default/chef\-getting\-started.txt.erb
specificity:  default
url:          https://someurlhere.com
.ft P
.fi
.sp
To view information in JSON format, use the \fB\-F\fP common option as part of the command like this:
.sp
.nf
.ft C
$ knife role show devops \-F json
.ft P
.fi
.sp
Other formats available include \fBtext\fP, \fByaml\fP, and \fBpp\fP.
.SH TEST
.sp
The \fBtest\fP argument is used to test a cookbook for syntax errors. This argument uses Ruby syntax checking to verify every file in a cookbook that ends in .rb and Embedded Ruby (ERB).
.sp
\fBSyntax\fP
.sp
This argument has the following syntax:
.sp
.nf
.ft C
$ knife cookbook test COOKBOOK_NAME (options)
.ft P
.fi
.sp
\fBOptions\fP
.sp
This argument has the following options:
.INDENT 0.0
.TP
.B \fB\-a\fP, \fB\-\-all\fP
Indicates that all cookbooks will be tested.
.TP
.B \fB\-o PATH:PATH\fP, \fB\-\-cookbook\-path PATH:PATH\fP
The directory in which cookbook are created. This can be a colon\-separated path.
.UNINDENT
.sp
\fBExamples\fP
.sp
To test a cookbook named "getting\-started", enter:
.sp
.nf
.ft C
$ knife cookbook test getting\-started
.ft P
.fi
.SH UPLOAD
.sp
The \fBupload\fP argument is used to upload one or more cookbooks (and any files that are associated with those cookbooks) from a local repository to the server. Only files that do not already exist on the server will be uploaded.
.IP Note
Use a chefignore file to prevent the upload of specific files and file types, such as temporary files or files placed in folders by version control systems. The chefignore file must be located in the root of the cookbook repository and must use rules similar to filename globbing (as defined by the Ruby \fBFile.fnmatch\fP syntax).
.RE
.sp
\fBSyntax\fP
.sp
This argument has the following syntax:
.sp
.nf
.ft C
$ knife cookbook upload [COOKBOOK_NAME...] (options)
.ft P
.fi
.sp
\fBOptions\fP
.sp
This argument has the following options:
.INDENT 0.0
.TP
.B \fB\-a\fP, \fB\-\-all\fP
Indicates that all cookbooks will be uploaded.
.TP
.B \fB\-d\fP, \fB\-\-include\-dependencies\fP
Indicates that when a cookbook has a dependency on one (or more) cookbooks, those cookbooks will also be uploaded.
.TP
.B \fB\-\-force\fP
Indicates that a cookbook should be updated even if the \fB\-\-freeze\fP flag has been set.
.TP
.B \fB\-\-freeze\fP
Indicates that a cookbook cannot be modified; any changes to this cookbook must be included as a new version. Only the \fB\-\-force\fP option can override this setting.
.TP
.B \fB\-o PATH:PATH\fP, \fB\-\-cookbook\-path PATH:PATH\fP
The directory in which cookbook are created. This can be a colon\-separated path.
.UNINDENT
.sp
\fBExamples\fP
.sp
To upload a cookbook named "getting\-started":
.sp
.nf
.ft C
$ knife cookbook upload getting\-started
.ft P
.fi
.sp
To upload a cookbook, and then prevent other users from being able to make changes to it, enter:
.sp
.nf
.ft C
$ knife cookbook upload redis \-\-freeze
.ft P
.fi
.sp
to return something like:
.sp
.nf
.ft C
Uploading redis...
Upload completed
.ft P
.fi
.sp
If a cookbook is frozen and the \fB\-\-force\fP option is not specified, Knife will return an error message similar to the following:
.sp
.nf
.ft C
Uploading redis...
ERROR: Version 0.1.6 of cookbook redis is frozen. Use \-\-force to override.
.ft P
.fi
.SH AUTHOR
Chef
.\" Generated by docutils manpage writer.
.