chef 0.9.0.b02 → 0.9.0.rc01
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of chef might be problematic. Click here for more details.
- data/distro/common/man/man8/knife.8 +178 -13
- data/distro/common/markdown/knife.mkd +105 -13
- data/lib/chef.rb +44 -0
- data/lib/chef/cookbook_version.rb +1 -1
- data/lib/chef/rest/rest_request.rb +21 -4
- data/lib/chef/version.rb +1 -1
- metadata +3 -3
@@ -70,7 +70,7 @@ Say yes to all prompts for confirmation
|
|
70
70
|
Show this message
|
71
71
|
.
|
72
72
|
.SH "SUB\-COMMANDS"
|
73
|
-
Knife sub\-commands are structured as
|
73
|
+
Knife sub\-commands are structured as \fINOUN verb NOUN (options)\fR. The sub\-commands are meant to be intuitively named. Because the Chef Server API is RESTful, sub\-commands generally utilize CRUD operations.
|
74
74
|
.
|
75
75
|
.IP "\(bu" 4
|
76
76
|
create (create)
|
@@ -104,7 +104,7 @@ Create an initial API Client
|
|
104
104
|
The path to your chef\-repo
|
105
105
|
.
|
106
106
|
.P
|
107
|
-
Create a configuration file for knife. This will prompt for values to enter into the file. Default values are listed in square brackets if no other entry is typed. See
|
107
|
+
Create a configuration file for knife. This will prompt for values to enter into the file. Default values are listed in square brackets if no other entry is typed. See \fBCONFIGURATION\fR below for available options.
|
108
108
|
.
|
109
109
|
.P
|
110
110
|
\fBindex rebuild\fR \fI(options)\fR
|
@@ -117,6 +117,12 @@ don't bother to ask if I'm sure
|
|
117
117
|
Rebuilds all the search indexes on the server.
|
118
118
|
.
|
119
119
|
.P
|
120
|
+
\fBrecipe list [PATTERN]\fR
|
121
|
+
.
|
122
|
+
.P
|
123
|
+
List available recipes from the server. Specify \fIPATTERN\fR as a regular expression to limit the results.
|
124
|
+
.
|
125
|
+
.P
|
120
126
|
\fBsearch INDEX QUERY\fR \fI(options)\fR
|
121
127
|
.
|
122
128
|
.TP
|
@@ -250,20 +256,32 @@ Cookbooks are the fundamental unit of distribution in Chef. They encapsulate all
|
|
250
256
|
Delete cookbooks on the Chef Server based on a regular expression. The regular expression (\fIREGEX\fR) should be in quotes, not in //'s.
|
251
257
|
.
|
252
258
|
.P
|
253
|
-
\fBcookbook delete COOKBOOK\fR \fI(options)\fR
|
259
|
+
\fBcookbook delete COOKBOOK [VERSION]\fR \fI(options)\fR
|
260
|
+
.
|
261
|
+
.TP
|
262
|
+
\fB\-a\fR, \fB\-\-all\fR
|
263
|
+
Delete all versions
|
254
264
|
.
|
255
265
|
.P
|
256
|
-
Delete
|
266
|
+
Delete the specified \fIVERSION\fR of the named \fICOOKBOOK\fR. If no version is specified, and only one version exists on the server, that version will be deleted. If multiple versions are available on the server, you will be prompted for a version to delete.
|
257
267
|
.
|
258
268
|
.P
|
259
|
-
\fBcookbook download COOKBOOK\fR \fI(options)\fR
|
269
|
+
\fBcookbook download COOKBOOK [VERSION]\fR \fI(options)\fR
|
260
270
|
.
|
261
271
|
.TP
|
262
|
-
\fB\-
|
263
|
-
The
|
272
|
+
\fB\-d\fR, \fB\-\-dir DOWNLOAD_DIRECTORY\fR
|
273
|
+
The directory to download the cookbook into
|
274
|
+
.
|
275
|
+
.TP
|
276
|
+
\fB\-f\fR, \fB\-\-force\fR
|
277
|
+
Overwrite an existing directory with the download
|
278
|
+
.
|
279
|
+
.TP
|
280
|
+
\fB\-N\fR, \fB\-\-latest\fR
|
281
|
+
Download the latest version of the cookbook
|
264
282
|
.
|
265
283
|
.P
|
266
|
-
Download a cookbook from the Chef Server
|
284
|
+
Download a cookbook from the Chef Server. If no version is specified and only one version exists on the server, that version will be downloaded. If no version is specified and multiple versions are available on the server, you will be prompted for a version to download.
|
267
285
|
.
|
268
286
|
.P
|
269
287
|
\fBcookbook list\fR \fI(options)\fR
|
@@ -287,7 +305,7 @@ Generate metadata for all cookbooks, rather than just a single cookbook
|
|
287
305
|
A colon\-separated path to look for cookbooks in
|
288
306
|
.
|
289
307
|
.P
|
290
|
-
Generate cookbook metadata for the named \fICOOKBOOK\fR. The \fIPATH\fR used here specifies where the
|
308
|
+
Generate cookbook metadata for the named \fICOOKBOOK\fR. The \fIPATH\fR used here specifies where the cookbooks directory is located and corresponds to the \fBcookbook_path\fR configuration option.
|
291
309
|
.
|
292
310
|
.P
|
293
311
|
\fBcookbook metadata from FILE\fR \fI(options)\fR
|
@@ -296,7 +314,7 @@ Generate cookbook metadata for the named \fICOOKBOOK\fR. The \fIPATH\fR used her
|
|
296
314
|
Load the cookbook metadata from a specified file.
|
297
315
|
.
|
298
316
|
.P
|
299
|
-
\fBcookbook show COOKBOOK [PART] [FILENAME]\fR \fI(options)\fR
|
317
|
+
\fBcookbook show COOKBOOK [VERSION] [PART] [FILENAME]\fR \fI(options)\fR
|
300
318
|
.
|
301
319
|
.TP
|
302
320
|
\fB\-f\fR, \fB\-\-fqdn FQDN \fR
|
@@ -311,7 +329,7 @@ The platform to see the file for
|
|
311
329
|
The platform version to see the file for
|
312
330
|
.
|
313
331
|
.P
|
314
|
-
Show a particular part of a \fICOOKBOOK\fR. \fIPART\fR can be one of:
|
332
|
+
Show a particular part of a \fICOOKBOOK\fR for the specified \fIVERSION\fR. \fIPART\fR can be one of:
|
315
333
|
.
|
316
334
|
.IP "\(bu" 4
|
317
335
|
\fIattributes\fR
|
@@ -434,6 +452,12 @@ Delete a data bag, or an item from a data bag.
|
|
434
452
|
Edit an item in a data bag.
|
435
453
|
.
|
436
454
|
.P
|
455
|
+
\fBdata bag from file BAG FILE\fR \fI(options)\fR
|
456
|
+
.
|
457
|
+
.P
|
458
|
+
Load a data bag item from a JSON file. Looks in the directory \fBdata_bags/BAG/ITEM.json\fR unless a relative path is specified.
|
459
|
+
.
|
460
|
+
.P
|
437
461
|
\fBdata bag list\fR \fI(options)\fR
|
438
462
|
.
|
439
463
|
.TP
|
@@ -522,6 +546,12 @@ Show only the run list
|
|
522
546
|
.P
|
523
547
|
Show a node.
|
524
548
|
.
|
549
|
+
.SH "RECIPE SUB\-COMMANDS"
|
550
|
+
\fBrecipe list [PATTERN]\fR
|
551
|
+
.
|
552
|
+
.P
|
553
|
+
List the recipes available on the server. The results shown can be limited with the optional PATTERN, which is a regular expression. PATTERN should be given in quotes, without slashes.
|
554
|
+
.
|
525
555
|
.SH "ROLE SUB\-COMMANDS"
|
526
556
|
\fBrole bulk delete REGEX\fR \fI(options)\fR
|
527
557
|
.
|
@@ -582,6 +612,68 @@ The next sections describe sub\-commands to work with various Cloud Computing AP
|
|
582
612
|
.P
|
583
613
|
The Rackspace and Terremark sub\-commands are early stage of development. Right now when creating instances of these types, knife will assume an Ubuntu image, install Ruby from packages, RubyGems from source and Chef as a RubyGem. As these commands are developed, other installation styles may become available, as options.
|
584
614
|
.
|
615
|
+
.P
|
616
|
+
\fBbootstrap FQDN [RUN LIST...]\fR \fI(options)\fR
|
617
|
+
.
|
618
|
+
.TP
|
619
|
+
\fB\-N\fR, \fB\-\-node\-name NAME\fR
|
620
|
+
The Chef node name for your new node
|
621
|
+
.
|
622
|
+
.TP
|
623
|
+
\fB\-P\fR, \fB\-\-ssh\-password PASSWORD\fR
|
624
|
+
The ssh password
|
625
|
+
.
|
626
|
+
.TP
|
627
|
+
\fB\-x\fR, \fB\-\-ssh\-user USERNAME\fR
|
628
|
+
The ssh username
|
629
|
+
.
|
630
|
+
.TP
|
631
|
+
\fB\-\-prerelease\fR
|
632
|
+
Install pre\-release Chef gems
|
633
|
+
.
|
634
|
+
.P
|
635
|
+
Performs a Chef Bootstrap on the target node. This subcommand is used internally by the various cloud computing server create commands. Currently assumes an Ubuntu base OS image and will take the following actions:
|
636
|
+
.
|
637
|
+
.IP "\(bu" 4
|
638
|
+
Updates APT cache.
|
639
|
+
.
|
640
|
+
.IP "\(bu" 4
|
641
|
+
Installs Ruby and packages required to build RubyGems with native extensions.
|
642
|
+
.
|
643
|
+
.IP "\(bu" 4
|
644
|
+
Installs RubyGems 1.3.6 \fBfrom source\fR.
|
645
|
+
.
|
646
|
+
.IP "\(bu" 4
|
647
|
+
Installs Chef and Ohai RubyGems.
|
648
|
+
.
|
649
|
+
.IP "\(bu" 4
|
650
|
+
Writes the validation.pem per the local knife configuration.
|
651
|
+
.
|
652
|
+
.IP "\(bu" 4
|
653
|
+
Writes a default config file for Chef.
|
654
|
+
.
|
655
|
+
.IP "\(bu" 4
|
656
|
+
Creates a JSON attributes file containing the node's run list and runs Chef.
|
657
|
+
.
|
658
|
+
.IP "" 0
|
659
|
+
.
|
660
|
+
.P
|
661
|
+
When this is complete, the bootstrapped node will have:
|
662
|
+
.
|
663
|
+
.IP "\(bu" 4
|
664
|
+
Latest Chef version installed from RubyGems.
|
665
|
+
.
|
666
|
+
.IP "\(bu" 4
|
667
|
+
Be validated with the configured Chef Server.
|
668
|
+
.
|
669
|
+
.IP "\(bu" 4
|
670
|
+
Have run Chef with its default run list.
|
671
|
+
.
|
672
|
+
.IP "" 0
|
673
|
+
.
|
674
|
+
.P
|
675
|
+
Future versions of this sub\-command will support performing Chef Bootstrap on other platforms.
|
676
|
+
.
|
585
677
|
.SH "EC2 SUB\-COMMANDS"
|
586
678
|
Chef is commonly used with Amazon AWS EC2 nodes. This sub\-command will generate instance metadata that can be used to automatically configure an EC2 instance with Chef. This requires an AMI that has Chef preinstalled with a configuration file that can parse the metadata at run\-time. At this time this is the only sub\-command for EC2, but more may be added later similar to \fBRACKSPACE\fR and \fBTERREMARK\fR below.
|
587
679
|
.
|
@@ -595,6 +687,76 @@ Edit the instance data
|
|
595
687
|
.P
|
596
688
|
The \fIRUN LIST\fR should be specified as a space separated list of roles or recipes that will be used by the instance to configure the server.
|
597
689
|
.
|
690
|
+
.P
|
691
|
+
\fBec2 server create [RUN LIST...]\fR \fI(options)\fR
|
692
|
+
.
|
693
|
+
.TP
|
694
|
+
\fB\-Z\fR, \fB\-\-availability\-zone ZONE\fR
|
695
|
+
The Availability Zone
|
696
|
+
.
|
697
|
+
.TP
|
698
|
+
\fB\-A\fR, \fB\-\-aws\-access\-key\-id KEY\fR
|
699
|
+
Your AWS Access Key ID
|
700
|
+
.
|
701
|
+
.TP
|
702
|
+
\fB\-K SECRET\fR, \fB\-\-aws\-secret\-access\-key\fR
|
703
|
+
Your AWS API Secret Access Key
|
704
|
+
.
|
705
|
+
.TP
|
706
|
+
\fB\-f\fR, \fB\-\-flavor FLAVOR\fR
|
707
|
+
The flavor of server (m1.small, m1.medium, etc)
|
708
|
+
.
|
709
|
+
.TP
|
710
|
+
\fB\-i\fR, \fB\-\-image IMAGE\fR
|
711
|
+
The AMI for the server
|
712
|
+
.
|
713
|
+
.TP
|
714
|
+
\fB\-\-prerelease\fR
|
715
|
+
Install the pre\-release chef gems
|
716
|
+
.
|
717
|
+
.TP
|
718
|
+
\fB\-G\fR, \fB\-\-groups X,Y,Z \fR
|
719
|
+
The security groups for this server
|
720
|
+
.
|
721
|
+
.TP
|
722
|
+
\fB\-S\fR, \fB\-\-ssh\-key KEY \fR
|
723
|
+
The SSH root key
|
724
|
+
.
|
725
|
+
.TP
|
726
|
+
\fB\-x\fR, \fB\-\-ssh\-user USERNAME\fR
|
727
|
+
The ssh username
|
728
|
+
.
|
729
|
+
.P
|
730
|
+
Creates a new Amazon AWS EC2 instance.
|
731
|
+
.
|
732
|
+
.P
|
733
|
+
\fBec2 server delete SERVER [SERVER]\fR \fI(options)\fR
|
734
|
+
.
|
735
|
+
.TP
|
736
|
+
\fB\-A\fR, \fB\-\-aws\-access\-key\-id KEY\fR
|
737
|
+
Your AWS Access Key ID
|
738
|
+
.
|
739
|
+
.TP
|
740
|
+
\fB\-K SECRET\fR, \fB\-\-aws\-secret\-access\-key\fR
|
741
|
+
Your AWS API Secret Access Key
|
742
|
+
.
|
743
|
+
.P
|
744
|
+
Terminates a running Amazon AWS EC2 instance.
|
745
|
+
.
|
746
|
+
.P
|
747
|
+
\fBec2 server list [RUN LIST...]\fR \fI(options)\fR
|
748
|
+
.
|
749
|
+
.TP
|
750
|
+
\fB\-A\fR, \fB\-\-aws\-access\-key\-id KEY\fR
|
751
|
+
Your AWS Access Key ID
|
752
|
+
.
|
753
|
+
.TP
|
754
|
+
\fB\-K SECRET\fR, \fB\-\-aws\-secret\-access\-key\fR
|
755
|
+
Your AWS API Secret Access Key
|
756
|
+
.
|
757
|
+
.P
|
758
|
+
List running Amazon AWS EC2 instances.
|
759
|
+
.
|
598
760
|
.SH "RACKSPACE SUB\-COMMANDS"
|
599
761
|
In addition to EC2 nodes, Chef can be used on Rackspace Cloud nodes. The following sub\-commands allow manipulating Rackspace Cloud nodes via the \fBfog\fR library.
|
600
762
|
.
|
@@ -682,7 +844,10 @@ Your terremark username
|
|
682
844
|
Lists running Terremark vCloud servers.
|
683
845
|
.
|
684
846
|
.SH "CONFIGURATION"
|
685
|
-
The knife configuration file is a Ruby DSL. If
|
847
|
+
The knife configuration file is a Ruby DSL to set configuration parameters for Knife's \fBGENERAL OPTIONS\fR. The default location for the config file is \fB~/.chef/knife.rb\fR. If managing multiple Chef repositories, per\-repository config files can be created. The file must be \fB.chef/knife.rb\fR in the current directory of the repository.
|
848
|
+
.
|
849
|
+
.P
|
850
|
+
If the config file exists, knife uses these settings for \fBGENERAL OPTIONS\fR defaults.
|
686
851
|
.
|
687
852
|
.P
|
688
853
|
\fBlog_level\fR
|
@@ -756,7 +921,7 @@ Specifies the private key file to use for generating ec2 instance data for valid
|
|
756
921
|
\fI~/.chef/knife.rb\fR
|
757
922
|
.
|
758
923
|
.P
|
759
|
-
Ruby DSL configuration file for knife. See
|
924
|
+
Ruby DSL configuration file for knife. See \fBCONFIGURATION\fR.
|
760
925
|
.
|
761
926
|
.SH "SEE ALSO"
|
762
927
|
Full documentation for Chef is located on the Chef wiki, http://wiki.opscode.com/display/chef/Home/.
|
@@ -42,7 +42,7 @@ Unless otherwise specified, output is in JSON format, and input files are also J
|
|
42
42
|
|
43
43
|
## SUB-COMMANDS
|
44
44
|
|
45
|
-
Knife sub-commands are structured as
|
45
|
+
Knife sub-commands are structured as _NOUN verb NOUN (options)_. The sub-commands are meant to be intuitively named. Because the Chef Server API is RESTful, sub-commands generally utilize CRUD operations.
|
46
46
|
|
47
47
|
* create (create)
|
48
48
|
* list and show (read)
|
@@ -62,7 +62,7 @@ __configure__ _(options)_
|
|
62
62
|
* `-r`, `--repository REPO`:
|
63
63
|
The path to your chef-repo
|
64
64
|
|
65
|
-
Create a configuration file for knife. This will prompt for values to enter into the file. Default values are listed in square brackets if no other entry is typed. See
|
65
|
+
Create a configuration file for knife. This will prompt for values to enter into the file. Default values are listed in square brackets if no other entry is typed. See __CONFIGURATION__ below for available options.
|
66
66
|
|
67
67
|
__index rebuild__ _(options)_
|
68
68
|
|
@@ -71,6 +71,10 @@ __index rebuild__ _(options)_
|
|
71
71
|
|
72
72
|
Rebuilds all the search indexes on the server.
|
73
73
|
|
74
|
+
__recipe list [PATTERN]__
|
75
|
+
|
76
|
+
List available recipes from the server. Specify _PATTERN_ as a regular expression to limit the results.
|
77
|
+
|
74
78
|
__search INDEX QUERY__ _(options)_
|
75
79
|
|
76
80
|
* `-a`, `--attribute ATTR`:
|
@@ -159,16 +163,23 @@ __cookbook bulk delete REGEX__ _(options)_
|
|
159
163
|
|
160
164
|
Delete cookbooks on the Chef Server based on a regular expression. The regular expression (_REGEX_) should be in quotes, not in //'s.
|
161
165
|
|
162
|
-
__cookbook delete
|
166
|
+
__cookbook delete COOKBOOK [VERSION]__ _(options)_
|
163
167
|
|
164
|
-
|
168
|
+
* `-a`, `--all`:
|
169
|
+
Delete all versions
|
165
170
|
|
166
|
-
|
171
|
+
Delete the specified _VERSION_ of the named _COOKBOOK_. If no version is specified, and only one version exists on the server, that version will be deleted. If multiple versions are available on the server, you will be prompted for a version to delete.
|
167
172
|
|
168
|
-
|
169
|
-
|
173
|
+
__cookbook download COOKBOOK [VERSION]__ _(options)_
|
174
|
+
|
175
|
+
* `-d`, `--dir DOWNLOAD_DIRECTORY`:
|
176
|
+
The directory to download the cookbook into
|
177
|
+
* `-f`, `--force`:
|
178
|
+
Overwrite an existing directory with the download
|
179
|
+
* `-N`, `--latest`:
|
180
|
+
Download the latest version of the cookbook
|
170
181
|
|
171
|
-
Download a cookbook from the Chef Server
|
182
|
+
Download a cookbook from the Chef Server. If no version is specified and only one version exists on the server, that version will be downloaded. If no version is specified and multiple versions are available on the server, you will be prompted for a version to download.
|
172
183
|
|
173
184
|
__cookbook list__ _(options)_
|
174
185
|
|
@@ -184,13 +195,13 @@ __cookbook metadata COOKBOOK__ _(options)_
|
|
184
195
|
* `-o`, `--cookbook-path PATH:PATH`:
|
185
196
|
A colon-separated path to look for cookbooks in
|
186
197
|
|
187
|
-
Generate cookbook metadata for the named _COOKBOOK_. The _PATH_ used here specifies where the
|
198
|
+
Generate cookbook metadata for the named _COOKBOOK_. The _PATH_ used here specifies where the cookbooks directory is located and corresponds to the `cookbook_path` configuration option.
|
188
199
|
|
189
200
|
__cookbook metadata from FILE__ _(options)_
|
190
201
|
|
191
202
|
Load the cookbook metadata from a specified file.
|
192
203
|
|
193
|
-
__cookbook show COOKBOOK [PART] [FILENAME]__ _(options)_
|
204
|
+
__cookbook show COOKBOOK [VERSION] [PART] [FILENAME]__ _(options)_
|
194
205
|
|
195
206
|
* `-f`, `--fqdn FQDN `:
|
196
207
|
The FQDN of the host to see the file for
|
@@ -199,7 +210,7 @@ __cookbook show COOKBOOK [PART] [FILENAME]__ _(options)_
|
|
199
210
|
* `-V`, `--platform-version VERSION`:
|
200
211
|
The platform version to see the file for
|
201
212
|
|
202
|
-
Show a particular part of a _COOKBOOK_. _PART_ can be one of:
|
213
|
+
Show a particular part of a _COOKBOOK_ for the specified _VERSION_. _PART_ can be one of:
|
203
214
|
|
204
215
|
* _attributes_
|
205
216
|
* _definitions_
|
@@ -277,6 +288,10 @@ __data bag edit BAG ITEM__ _(options)_
|
|
277
288
|
|
278
289
|
Edit an item in a data bag.
|
279
290
|
|
291
|
+
__data bag from file BAG FILE__ _(options)_
|
292
|
+
|
293
|
+
Load a data bag item from a JSON file. Looks in the directory `data_bags/BAG/ITEM.json` unless a relative path is specified.
|
294
|
+
|
280
295
|
__data bag list__ _(options)_
|
281
296
|
|
282
297
|
* `-w`, `--with-uri`:
|
@@ -339,6 +354,11 @@ __node show NODE__ _(options)_
|
|
339
354
|
|
340
355
|
Show a node.
|
341
356
|
|
357
|
+
## RECIPE SUB-COMMANDS
|
358
|
+
__recipe list [PATTERN]__
|
359
|
+
|
360
|
+
List the recipes available on the server. The results shown can be limited with the optional PATTERN, which is a regular expression. PATTERN should be given in quotes, without slashes.
|
361
|
+
|
342
362
|
## ROLE SUB-COMMANDS
|
343
363
|
|
344
364
|
__role bulk delete REGEX__ _(options)_
|
@@ -384,6 +404,35 @@ The next sections describe sub-commands to work with various Cloud Computing API
|
|
384
404
|
|
385
405
|
The Rackspace and Terremark sub-commands are early stage of development. Right now when creating instances of these types, knife will assume an Ubuntu image, install Ruby from packages, RubyGems from source and Chef as a RubyGem. As these commands are developed, other installation styles may become available, as options.
|
386
406
|
|
407
|
+
__bootstrap FQDN [RUN LIST...]__ _(options)_
|
408
|
+
|
409
|
+
* `-N`, `--node-name NAME`:
|
410
|
+
The Chef node name for your new node
|
411
|
+
* `-P`, `--ssh-password PASSWORD`:
|
412
|
+
The ssh password
|
413
|
+
* `-x`, `--ssh-user USERNAME`:
|
414
|
+
The ssh username
|
415
|
+
* `--prerelease`:
|
416
|
+
Install pre-release Chef gems
|
417
|
+
|
418
|
+
Performs a Chef Bootstrap on the target node. This subcommand is used internally by the various cloud computing server create commands. Currently assumes an Ubuntu base OS image and will take the following actions:
|
419
|
+
|
420
|
+
- Updates APT cache.
|
421
|
+
- Installs Ruby and packages required to build RubyGems with native extensions.
|
422
|
+
- Installs RubyGems 1.3.6 **from source**.
|
423
|
+
- Installs Chef and Ohai RubyGems.
|
424
|
+
- Writes the validation.pem per the local knife configuration.
|
425
|
+
- Writes a default config file for Chef.
|
426
|
+
- Creates a JSON attributes file containing the node's run list and runs Chef.
|
427
|
+
|
428
|
+
When this is complete, the bootstrapped node will have:
|
429
|
+
|
430
|
+
- Latest Chef version installed from RubyGems.
|
431
|
+
- Be validated with the configured Chef Server.
|
432
|
+
- Have run Chef with its default run list.
|
433
|
+
|
434
|
+
Future versions of this sub-command will support performing Chef Bootstrap on other platforms.
|
435
|
+
|
387
436
|
## EC2 SUB-COMMANDS
|
388
437
|
|
389
438
|
Chef is commonly used with Amazon AWS EC2 nodes. This sub-command will generate instance metadata that can be used to automatically configure an EC2 instance with Chef. This requires an AMI that has Chef preinstalled with a configuration file that can parse the metadata at run-time. At this time this is the only sub-command for EC2, but more may be added later similar to __RACKSPACE__ and __TERREMARK__ below.
|
@@ -395,6 +444,47 @@ __ec2 instance data [RUN LIST...]__ _(options)_
|
|
395
444
|
|
396
445
|
The _RUN LIST_ should be specified as a space separated list of roles or recipes that will be used by the instance to configure the server.
|
397
446
|
|
447
|
+
__ec2 server create [RUN LIST...]__ _(options)_
|
448
|
+
|
449
|
+
* `-Z`, `--availability-zone ZONE`:
|
450
|
+
The Availability Zone
|
451
|
+
* `-A`, `--aws-access-key-id KEY `:
|
452
|
+
Your AWS Access Key ID
|
453
|
+
* `-K SECRET`, `--aws-secret-access-key`:
|
454
|
+
Your AWS API Secret Access Key
|
455
|
+
* `-f`, `--flavor FLAVOR`:
|
456
|
+
The flavor of server (m1.small, m1.medium, etc)
|
457
|
+
* `-i`, `--image IMAGE`:
|
458
|
+
The AMI for the server
|
459
|
+
* `--prerelease`:
|
460
|
+
Install the pre-release chef gems
|
461
|
+
* `-G`, `--groups X,Y,Z `:
|
462
|
+
The security groups for this server
|
463
|
+
* `-S`, `--ssh-key KEY `:
|
464
|
+
The SSH root key
|
465
|
+
* `-x`, `--ssh-user USERNAME`:
|
466
|
+
The ssh username
|
467
|
+
|
468
|
+
Creates a new Amazon AWS EC2 instance.
|
469
|
+
|
470
|
+
__ec2 server delete SERVER [SERVER]__ _(options)_
|
471
|
+
|
472
|
+
* `-A`, `--aws-access-key-id KEY`:
|
473
|
+
Your AWS Access Key ID
|
474
|
+
* `-K SECRET`, `--aws-secret-access-key`:
|
475
|
+
Your AWS API Secret Access Key
|
476
|
+
|
477
|
+
Terminates a running Amazon AWS EC2 instance.
|
478
|
+
|
479
|
+
__ec2 server list [RUN LIST...]__ _(options)_
|
480
|
+
|
481
|
+
* `-A`, `--aws-access-key-id KEY`:
|
482
|
+
Your AWS Access Key ID
|
483
|
+
* `-K SECRET`, `--aws-secret-access-key`:
|
484
|
+
Your AWS API Secret Access Key
|
485
|
+
|
486
|
+
List running Amazon AWS EC2 instances.
|
487
|
+
|
398
488
|
## RACKSPACE SUB-COMMANDS
|
399
489
|
|
400
490
|
In addition to EC2 nodes, Chef can be used on Rackspace Cloud nodes. The following sub-commands allow manipulating Rackspace Cloud nodes via the `fog` library.
|
@@ -454,7 +544,9 @@ Lists running Terremark vCloud servers.
|
|
454
544
|
|
455
545
|
## CONFIGURATION
|
456
546
|
|
457
|
-
The knife configuration file is a Ruby DSL. If
|
547
|
+
The knife configuration file is a Ruby DSL to set configuration parameters for Knife's __GENERAL OPTIONS__. The default location for the config file is `~/.chef/knife.rb`. If managing multiple Chef repositories, per-repository config files can be created. The file must be `.chef/knife.rb` in the current directory of the repository.
|
548
|
+
|
549
|
+
If the config file exists, knife uses these settings for __GENERAL OPTIONS__ defaults.
|
458
550
|
|
459
551
|
`log_level`
|
460
552
|
|
@@ -501,7 +593,7 @@ Specifies the private key file to use for generating ec2 instance data for valid
|
|
501
593
|
|
502
594
|
_~/.chef/knife.rb_
|
503
595
|
|
504
|
-
Ruby DSL configuration file for knife. See
|
596
|
+
Ruby DSL configuration file for knife. See __CONFIGURATION__.
|
505
597
|
|
506
598
|
## SEE ALSO
|
507
599
|
|
data/lib/chef.rb
CHANGED
@@ -62,3 +62,47 @@ class String
|
|
62
62
|
alias :bytesize :size
|
63
63
|
end
|
64
64
|
end
|
65
|
+
|
66
|
+
|
67
|
+
# Tempfile has a horrible bug where it causes an IOError: closed stream in its
|
68
|
+
# finalizer, leading to intermittent application crashes with confusing stack
|
69
|
+
# traces. Here we monkey patch the fix into place. You can track the bug on
|
70
|
+
# ruby's redmine: http://redmine.ruby-lang.org/issues/show/3119
|
71
|
+
class Tempfile
|
72
|
+
# Tempfile has changes between 1.8.x and 1.9.x
|
73
|
+
# so we monkey patch separately
|
74
|
+
if RUBY_VERSION =~ /^1\.8/
|
75
|
+
def unlink
|
76
|
+
# keep this order for thread safeness
|
77
|
+
begin
|
78
|
+
File.unlink(@tmpname) if File.exist?(@tmpname)
|
79
|
+
@@cleanlist.delete(@tmpname)
|
80
|
+
@tmpname = nil
|
81
|
+
ObjectSpace.undefine_finalizer(self)
|
82
|
+
rescue Errno::EACCES
|
83
|
+
# may not be able to unlink on Windows; just ignore
|
84
|
+
end
|
85
|
+
end
|
86
|
+
alias delete unlink
|
87
|
+
|
88
|
+
|
89
|
+
# There is a patch for this, to be merged into 1.9 at some point.
|
90
|
+
# When that happens, we'll want to also check the RUBY_PATCHLEVEL
|
91
|
+
elsif RUBY_VERSION =~ /^1\.9/
|
92
|
+
def unlink
|
93
|
+
# keep this order for thread safeness
|
94
|
+
return unless @tmpname
|
95
|
+
begin
|
96
|
+
if File.exist?(@tmpname)
|
97
|
+
File.unlink(@tmpname)
|
98
|
+
end
|
99
|
+
# remove tmpname from remover
|
100
|
+
@data[0] = @data[2] = nil
|
101
|
+
@tmpname = nil
|
102
|
+
rescue Errno::EACCES
|
103
|
+
# may not be able to unlink on Windows; just ignore
|
104
|
+
end
|
105
|
+
end
|
106
|
+
alias delete unlink
|
107
|
+
end
|
108
|
+
end
|
@@ -727,7 +727,7 @@ class Chef
|
|
727
727
|
def self.cdb_load(name, version='latest', couchdb=nil)
|
728
728
|
cdb = couchdb || Chef::CouchDB.new
|
729
729
|
if version == "latest" || version == "_latest"
|
730
|
-
rs = cdb.get_view("
|
730
|
+
rs = cdb.get_view("cookbooks", "all_latest_version", :key => name, :descending => true, :group => true, :reduce => true)["rows"].first
|
731
731
|
cdb.load("cookbook_version", "#{rs["key"]}-#{rs["value"]}")
|
732
732
|
else
|
733
733
|
cdb.load("cookbook_version", "#{name}-#{version}")
|
@@ -55,10 +55,12 @@ class Chef
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def call
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
58
|
+
hide_net_http_bug do
|
59
|
+
http_client.request(http_request) do |response|
|
60
|
+
store_cookie(response)
|
61
|
+
yield response if block_given?
|
62
|
+
response
|
63
|
+
end
|
62
64
|
end
|
63
65
|
end
|
64
66
|
|
@@ -68,6 +70,21 @@ class Chef
|
|
68
70
|
|
69
71
|
private
|
70
72
|
|
73
|
+
def hide_net_http_bug
|
74
|
+
yield
|
75
|
+
rescue NoMethodError => e
|
76
|
+
# http://redmine.ruby-lang.org/issues/show/2708
|
77
|
+
# http://redmine.ruby-lang.org/issues/show/2758
|
78
|
+
if e.to_s =~ /#{Regexp.escape(%q|undefined method `closed?' for nil:NilClass|)}/
|
79
|
+
Chef::Log.debug("rescued error in http connect, re-raising as Errno::ECONNREFUSED to hide bug in net/http")
|
80
|
+
Chef::Log.debug("#{e.class.name}: #{e.to_s}")
|
81
|
+
Chef::Log.debug(e.backtrace.join("\n"))
|
82
|
+
raise Errno::ECONNREFUSED, "Connection refused attempting to contact #{url.scheme}://#{host}:#{port}"
|
83
|
+
else
|
84
|
+
raise
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
71
88
|
def store_cookie(response)
|
72
89
|
if response['set-cookie']
|
73
90
|
@cookies["#{host}:#{port}"] = response['set-cookie']
|
data/lib/chef/version.rb
CHANGED
metadata
CHANGED
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
|
|
6
6
|
- 0
|
7
7
|
- 9
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.9.0.
|
9
|
+
- rc01
|
10
|
+
version: 0.9.0.rc01
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Adam Jacob
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-06-
|
18
|
+
date: 2010-06-15 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|