knife-server 0.3.3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +14 -4
- data/CHANGELOG.md +50 -9
- data/Gemfile +3 -0
- data/README.md +112 -40
- data/knife-server.gemspec +2 -1
- data/lib/chef/knife/bootstrap/_common.sh +24 -0
- data/lib/chef/knife/bootstrap/_omnibus.sh +117 -0
- data/lib/chef/knife/bootstrap/_platform_and_version.sh +115 -0
- data/lib/chef/knife/bootstrap/_set_hostname.sh +60 -0
- data/lib/chef/knife/bootstrap/auto.sh +116 -0
- data/lib/chef/knife/bootstrap/{chef-server-debian.erb → chef10/debian.erb} +22 -40
- data/lib/chef/knife/bootstrap/chef10/rhel.erb +185 -0
- data/lib/chef/knife/bootstrap/chef11/omnibus.erb +64 -0
- data/lib/chef/knife/bootstrap/chef11/rhel.erb +142 -0
- data/lib/chef/knife/server_bootstrap_base.rb +89 -41
- data/lib/chef/knife/server_bootstrap_ec2.rb +46 -74
- data/lib/chef/knife/server_bootstrap_standalone.rb +25 -19
- data/lib/knife/server/credentials.rb +44 -7
- data/lib/knife/server/ssh.rb +57 -1
- data/lib/knife/server/version.rb +1 -1
- data/spec/chef/knife/server_bootstrap_ec2_spec.rb +28 -5
- data/spec/chef/knife/server_bootstrap_standalone_spec.rb +66 -5
- data/spec/knife/server/credientials_spec.rb +34 -0
- metadata +14 -6
data/.travis.yml
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
- 1.9.3
|
4
|
+
- 1.9.2
|
5
|
+
- ruby-head
|
6
|
+
- 1.8.7
|
7
|
+
- ree
|
8
|
+
|
9
|
+
env:
|
10
|
+
- "CHEF_VERSION=11.4.0"
|
11
|
+
- "CHEF_VERSION=10.24.0"
|
12
|
+
- "CHEF_VERSION=0.10.10"
|
13
|
+
|
14
|
+
matrix:
|
15
|
+
allow_failures:
|
16
|
+
- rvm: ruby-head
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,47 @@
|
|
1
|
-
## 0.
|
1
|
+
## 1.0.0 / 2013-02-28
|
2
2
|
|
3
|
+
### Breaking Changes
|
3
4
|
|
4
|
-
|
5
|
+
* Default Chef Server installed is the latest Chef 11 (erchef) version from
|
6
|
+
Omnibus packages via the `"chef11/omnibus"` template. All platform supported
|
7
|
+
by the Omnibus packages should work out of the box. Chef Server 10 is still
|
8
|
+
supported by setting the --bootstrap-version flag to "10". ([@fnichol][])
|
9
|
+
* WebUI is no longer configured to start up by default (--enable-webui flag
|
10
|
+
introduced to re-enable). For more details, please read
|
11
|
+
http://lists.opscode.com/sympa/arc/chef-dev/2013-02/msg00023.html.
|
12
|
+
([@fnichol][])
|
13
|
+
* The knife-ec2 gem is no longer a direct dependency; you must add install this
|
14
|
+
gem or add it to your Gemfile in order to use `knife server bootstrap ec2`.
|
15
|
+
([@fnichol][])
|
16
|
+
|
17
|
+
### New features
|
18
|
+
|
19
|
+
* First class support for RHEL platform family nodes including CentOS,
|
20
|
+
Scientific, RHEL, Amazon Linux, etc. Seriously, this is huge. ([@danryan][],
|
21
|
+
[@erikh][])
|
22
|
+
* Support for installing Chef 11 (erchef) servers from Omnibus packages.
|
23
|
+
([@fnicho][])
|
24
|
+
* Add --log-level flag to help debug bootstrap template output. ([@fnichol][])
|
25
|
+
* Support all relevant options from `Chef::Knife::Bootstrap` and
|
26
|
+
`Chef::Knife::Ec2ServerCreate` in the standalone and ec2 subcommands. This
|
27
|
+
includes --bootstrap-version, ssh options, ebs options, etc. ([@fnichol][])
|
28
|
+
* An auto mode (set via --platform auto) which will detect the node's platform
|
29
|
+
and run the appropriate template for Chef 10 servers. Currently only
|
30
|
+
supported with standalone subcommand. ([@erikh][])
|
31
|
+
|
32
|
+
### Improvements
|
33
|
+
|
34
|
+
* Ensure config parameters are applied in the right order for Chef 10/11.
|
35
|
+
([@fnichol][])
|
36
|
+
* Add matrix build support to TravisCI for multiple versions of Chef.
|
37
|
+
([@fnichol][])
|
38
|
+
* Update README badges (better consistency). ([@fnichol][])
|
39
|
+
* Update CHANGLOG format headings for Vandamme/Gemnasium compatability.
|
40
|
+
([@fnichol][])
|
41
|
+
* Update README documentation with 1.0.0 changes. ([@fnichol][])
|
42
|
+
|
43
|
+
|
44
|
+
## 0.3.3 / 2012-12-24
|
5
45
|
|
6
46
|
### Bug fixes
|
7
47
|
|
@@ -9,7 +49,7 @@
|
|
9
49
|
identity-file when `nil` is passed in. ([@erikh][])
|
10
50
|
|
11
51
|
|
12
|
-
## 0.3.2
|
52
|
+
## 0.3.2 / 2012-12-19
|
13
53
|
|
14
54
|
### Improvements
|
15
55
|
|
@@ -23,7 +63,7 @@
|
|
23
63
|
users of this gem. ([@fnichol][])
|
24
64
|
|
25
65
|
|
26
|
-
## 0.3.1
|
66
|
+
## 0.3.1 / 2012-12-12
|
27
67
|
|
28
68
|
### Bug fixes
|
29
69
|
|
@@ -41,7 +81,7 @@
|
|
41
81
|
* Update usage section in README.
|
42
82
|
|
43
83
|
|
44
|
-
## 0.3.0
|
84
|
+
## 0.3.0 / 2012-07-07
|
45
85
|
|
46
86
|
### New features
|
47
87
|
|
@@ -50,7 +90,7 @@
|
|
50
90
|
([@fnichol][])
|
51
91
|
|
52
92
|
|
53
|
-
## 0.2.2
|
93
|
+
## 0.2.2 / 2012-07-04
|
54
94
|
|
55
95
|
### New features
|
56
96
|
|
@@ -62,7 +102,7 @@
|
|
62
102
|
* Add Code Climate badge to README. ([@fnichol][])
|
63
103
|
|
64
104
|
|
65
|
-
## 0.2.1
|
105
|
+
## 0.2.1 / 2012-07-03
|
66
106
|
|
67
107
|
### Improvements
|
68
108
|
|
@@ -70,7 +110,7 @@
|
|
70
110
|
http://wiki.opscode.com/display/chef/Knife+Plugins. ([@fnichol][])
|
71
111
|
|
72
112
|
|
73
|
-
## 0.2.0
|
113
|
+
## 0.2.0 / 2012-07-03
|
74
114
|
|
75
115
|
### Bug fixes
|
76
116
|
|
@@ -85,10 +125,11 @@
|
|
85
125
|
([@fnichol][])
|
86
126
|
|
87
127
|
|
88
|
-
## 0.1.0
|
128
|
+
## 0.1.0 / 2012-06-23
|
89
129
|
|
90
130
|
The initial release.
|
91
131
|
|
132
|
+
[@danryan]: https://github.com/danryan
|
92
133
|
[@erikh]: https://github.com/erikh
|
93
134
|
[@fnichol]: https://github.com/fnichol
|
94
135
|
[@iafonov]: https://github.com/iafonov
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# <a name="title"></a> Knife::Server
|
2
2
|
|
3
|
-
[](http://travis-ci.org/fnichol/knife-server)
|
3
|
+
[](http://travis-ci.org/fnichol/knife-server)
|
4
|
+
[](https://codeclimate.com/github/fnichol/knife-server)
|
4
5
|
|
5
6
|
An Opscode Chef knife plugin to manage Chef Servers. Bootstrap a new Chef
|
6
7
|
Server on Amazon's EC2 or a standalone server. Backup and restore your Chef
|
@@ -12,8 +13,27 @@ Follow the [installation](#installation) instructions, then you are ready
|
|
12
13
|
to create your very own Chef Server running Ubuntu on Amazon's EC2 service:
|
13
14
|
|
14
15
|
```bash
|
15
|
-
$ knife server bootstrap ec2
|
16
|
-
--node-name chefapalooza.example.com
|
16
|
+
$ knife server bootstrap ec2 \
|
17
|
+
--node-name chefapalooza.example.com \
|
18
|
+
--aws-access-key-id $AWS_ACCESS_KEY_ID \
|
19
|
+
--aws-secret-access-key $AWS_SECRET_ACCESS_KEY \
|
20
|
+
--region us-east-1 \
|
21
|
+
--availability-zone us-east-1b \
|
22
|
+
--image ami-de0d9eb7 \
|
23
|
+
--ssh-user ubuntu \
|
24
|
+
--flavor m1.small \
|
25
|
+
--ssh-key id_rsa-aws \
|
26
|
+
--identity-file ~/.ssh/id_rsa-aws
|
27
|
+
```
|
28
|
+
|
29
|
+
Be sure to substitute with your access key id, secret access key, ssh key id,
|
30
|
+
and identity file (private SSH key). If you have most of these settings set
|
31
|
+
up in a `knife.rb` file, it becomes much shorter:
|
32
|
+
|
33
|
+
```bash
|
34
|
+
$ knife server bootstrap ec2 \
|
35
|
+
--node-name chefapalooza.example.com \
|
36
|
+
--ssh-user ubuntu
|
17
37
|
```
|
18
38
|
|
19
39
|
Or maybe you want to try out a Chef Server using [Vagrant][vagrant_site]?
|
@@ -23,13 +43,16 @@ $ cat <<VAGRANTFILE > Vagrantfile
|
|
23
43
|
Vagrant::Config.run do |config|
|
24
44
|
config.vm.box = "precise64"
|
25
45
|
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
|
26
|
-
config.vm.network :hostonly, "192.168.33.
|
46
|
+
config.vm.network :hostonly, "192.168.33.10"
|
27
47
|
config.vm.customize ["modifyvm", :id, "--memory", 2048]
|
28
48
|
end
|
29
49
|
VAGRANTFILE
|
30
50
|
$ vagrant up
|
31
|
-
$ knife server bootstrap standalone
|
32
|
-
--node-name chefapalooza.example.com
|
51
|
+
$ knife server bootstrap standalone \
|
52
|
+
--node-name chefapalooza.example.com \
|
53
|
+
--host 192.168.33.10 \
|
54
|
+
--ssh-user vagrant \
|
55
|
+
--ssh--password vagrant
|
33
56
|
```
|
34
57
|
|
35
58
|
Taking a backup of all node, role, data bag, and environment data is also a
|
@@ -69,7 +92,14 @@ Add this line to your application's Gemfile:
|
|
69
92
|
gem 'knife-server'
|
70
93
|
```
|
71
94
|
|
72
|
-
|
95
|
+
**Note** If you want to use the `bootstrap ec2` subcommand you will need to
|
96
|
+
explicitly add this to your Gemfile with:
|
97
|
+
|
98
|
+
```ruby
|
99
|
+
gem 'knife-ec2'
|
100
|
+
```
|
101
|
+
|
102
|
+
Finally execute:
|
73
103
|
|
74
104
|
```bash
|
75
105
|
$ bundle
|
@@ -81,6 +111,9 @@ Or install it yourself as:
|
|
81
111
|
$ gem install knife-server
|
82
112
|
```
|
83
113
|
|
114
|
+
(Don't forget a `gem install knife-ec2` if using the `bootstrap ec2`
|
115
|
+
subcommand).
|
116
|
+
|
84
117
|
Next, you **must** set up a [knife.rb configuration](#installation-knife) so
|
85
118
|
that the shipped Knife subcommands know where to place and modify key files,
|
86
119
|
backup directories, etc.
|
@@ -141,23 +174,26 @@ These subcommands will install and configure an Open Source Chef Server on
|
|
141
174
|
several different clouds/environments. The high level step taken are as
|
142
175
|
follows:
|
143
176
|
|
144
|
-
1. Provision or use a node and install the Chef Server software
|
145
|
-
an Apache2 instance
|
146
|
-
|
177
|
+
1. Provision or use a node and install the Chef Server software. If it is a
|
178
|
+
Chef 10 server, configure an Apache2 instance to front the server instance
|
179
|
+
handling SSL for the API port (TCP/443) and the WebUI web application
|
180
|
+
(TCP/444, if enabled).
|
147
181
|
2. Fetch the validation key from the server and install it onto the
|
148
182
|
workstation issuing the knife subcommand. The validation key will be
|
149
183
|
installed at the path defined in the knife `validation_key` variable.
|
150
184
|
If a key already exists at that path a backup copy will be made in the
|
151
185
|
same directory.
|
152
|
-
3. Create an initial admin
|
186
|
+
3. Create an initial admin user key called `root` in the root user's account
|
153
187
|
on the server which can be used for local administration of the Chef
|
154
|
-
Server.
|
155
|
-
|
188
|
+
Server. If it is a Chef 10 installation, an admin client key will be
|
189
|
+
generated instead.
|
190
|
+
4. Create an admin user key with the name defined in the knife
|
156
191
|
`node_name` configuration variable and install it onto the workstation
|
157
|
-
issuing the knife subcommand. The
|
192
|
+
issuing the knife subcommand. The user key will be installed at the
|
158
193
|
path defined in the knife `client_key` configuration variable. If a key
|
159
194
|
already exists at that path a backup copy will be made in the same
|
160
|
-
directory.
|
195
|
+
directory. If it is a Chef 10 installation, an admin client key will be
|
196
|
+
generated instead.
|
161
197
|
|
162
198
|
**Note** `knife server bootstrap` can not be invoked directly; a subcommand
|
163
199
|
must be selected which determines the provisioning strategy.
|
@@ -178,7 +214,9 @@ The platform type that will be bootstrapped. By convention a bootstrap
|
|
178
214
|
template of `chef-server-#{platform}.erb` will be searched for in the
|
179
215
|
template lookup locations (gems, .chef directory, etc.).
|
180
216
|
|
181
|
-
The default value is `"
|
217
|
+
The default value is `"omnibus"` which supports all platforms for which Omnibus
|
218
|
+
packages have been created. For more details, visit the [Install
|
219
|
+
Chef][install_chef] page and click on *"Chef Server"*.
|
182
220
|
|
183
221
|
##### --ssh-user USER (-x)
|
184
222
|
|
@@ -194,9 +232,15 @@ The SSH port used when bootstrapping the Chef Server node.
|
|
194
232
|
|
195
233
|
The default value is `"22"`.
|
196
234
|
|
235
|
+
##### --[no-]host-key-verify
|
236
|
+
|
237
|
+
Verify and cache SSH host key when connecting.
|
238
|
+
|
239
|
+
The default value is `true`
|
240
|
+
|
197
241
|
##### --identity-file IDENTITY\_FILE (-i)
|
198
242
|
|
199
|
-
The SSH identity file used for authentication.
|
243
|
+
The SSH identity file (private SSH key) used for authentication.
|
200
244
|
|
201
245
|
##### --prerelease
|
202
246
|
|
@@ -204,7 +248,9 @@ Installs a pre-release Chef gem rather than a stable release version.
|
|
204
248
|
|
205
249
|
##### --bootstrap-version VERSION
|
206
250
|
|
207
|
-
The version of Chef to install.
|
251
|
+
The version of Chef to install. For Chef 11 installations (the default), you
|
252
|
+
can provide the version of Omnibus package you want installed. To install a
|
253
|
+
Chef 10 server, set this value to `"10"`.
|
208
254
|
|
209
255
|
##### --template-file TEMPLATE
|
210
256
|
|
@@ -214,11 +260,18 @@ The full path to location of template to use.
|
|
214
260
|
|
215
261
|
Bootstraps the Chef Server using a particular bootstrap template.
|
216
262
|
|
217
|
-
The default is `"
|
263
|
+
The default is `"chef11/#{platform}"`.
|
264
|
+
|
265
|
+
##### --[no-]webui-enable
|
266
|
+
|
267
|
+
Whether or no the WebUI interface will be installed and enabled.
|
268
|
+
|
269
|
+
The default value is `false`.
|
218
270
|
|
219
271
|
##### --webui-password PASSWORD
|
220
272
|
|
221
|
-
The initial password for the WebUI admin account
|
273
|
+
The initial password for the WebUI admin account, root user account, and
|
274
|
+
workstation user account.
|
222
275
|
|
223
276
|
The default value is `"chefchef"`.
|
224
277
|
|
@@ -230,6 +283,10 @@ The default value is `"chefchef"`.
|
|
230
283
|
|
231
284
|
### <a name="knife-server-bootstrap-ec2"></a> knife server bootstrap ec2
|
232
285
|
|
286
|
+
**Note:** You must install the [knife-ec2 gem][knife-ec2] to use this
|
287
|
+
subcommand. This was done to keep the dependencies of this library lighter and
|
288
|
+
to make future cloud adapter support easier to add.
|
289
|
+
|
233
290
|
Provisions an EC2 instance on the Amazon Web Services (AWS) cloud and sets
|
234
291
|
up an Open Source Chef Server as described [above](#knife-server-bootstrap).
|
235
292
|
In addition, the following steps are taken initially:
|
@@ -242,6 +299,16 @@ In addition, the following steps are taken initially:
|
|
242
299
|
|
243
300
|
#### Configuration
|
244
301
|
|
302
|
+
This subcommand imports all relavent options from the knife-ec2 gem. For
|
303
|
+
detailed documentation relating to these options, please visit the [docs
|
304
|
+
page][docs_knife_ec2].
|
305
|
+
|
306
|
+
##### --availability-zone ZONE (-Z)
|
307
|
+
|
308
|
+
The availability zone for the EC2 instance.
|
309
|
+
|
310
|
+
The default value is `"us-east-1b"`.
|
311
|
+
|
245
312
|
##### --aws-access-key-id KEY (-A)
|
246
313
|
|
247
314
|
Your AWS access key ID.
|
@@ -254,16 +321,17 @@ Your AWS API secret access key.
|
|
254
321
|
|
255
322
|
This option is **required**.
|
256
323
|
|
257
|
-
##### --
|
324
|
+
##### --ebs-optimized
|
258
325
|
|
259
|
-
|
326
|
+
Enabled optimized EBS I/O.
|
260
327
|
|
261
|
-
|
262
|
-
explicitly.
|
328
|
+
##### --ebs-size SIZE
|
263
329
|
|
264
|
-
|
330
|
+
The size of the EBS volume in GB, for EBS-backed instances.
|
265
331
|
|
266
|
-
|
332
|
+
##### --ebs-no-delete-on-term
|
333
|
+
|
334
|
+
Do not delete EBS volumn on instance termination.
|
267
335
|
|
268
336
|
##### --flavor FLAVOR (-f)
|
269
337
|
|
@@ -271,21 +339,30 @@ The flavor of EC2 instance (m1.small, m1.medium, etc).
|
|
271
339
|
|
272
340
|
The default value is `"m1.small"`.
|
273
341
|
|
342
|
+
##### --groups X,Y,Z (-G)
|
343
|
+
|
344
|
+
The security groups for this EC2 instance.
|
345
|
+
|
346
|
+
The default value is `"infrastructure"`.
|
347
|
+
|
274
348
|
##### --image IMAGE (-I)
|
275
349
|
|
276
350
|
The AMI for the EC2 instance.
|
277
351
|
|
278
|
-
##### --
|
352
|
+
##### --region REGION
|
279
353
|
|
280
|
-
The
|
354
|
+
The desired AWS region, such as `"us-east-1"` or `"us-west-2"`.
|
281
355
|
|
282
|
-
The default value is `"us-east-
|
356
|
+
The default value is `"us-east-1"` but is strongly encouraged to be set
|
357
|
+
explicitly.
|
283
358
|
|
284
|
-
##### --
|
359
|
+
##### --subnet SUBNET-ID (-s)
|
285
360
|
|
286
|
-
|
361
|
+
Create node in this Virtual Private Cloud Subnet ID (implies VPC mode).
|
287
362
|
|
288
|
-
|
363
|
+
##### --ssh-key KEY (-S)
|
364
|
+
|
365
|
+
The AWS SSH key id.
|
289
366
|
|
290
367
|
##### --tags T=V\[,T=V,...\] (-T)
|
291
368
|
|
@@ -296,15 +373,8 @@ The resulting set will include:
|
|
296
373
|
* `"Node=#{config[:chef_node_name]}"`
|
297
374
|
* `"Role=chef_server"`
|
298
375
|
|
299
|
-
##### --ebs-size SIZE
|
300
|
-
|
301
|
-
The size of the EBS volume in GB, for EBS-backed instances.
|
302
|
-
|
303
|
-
##### --ebs-no-delete-on-term
|
304
|
-
|
305
|
-
Do not delete EBS volumn on instance termination.
|
306
|
-
|
307
376
|
### <a name="knife-server-bootstrap-standalone"></a> knife server bootstrap standalone
|
377
|
+
|
308
378
|
Provisions a standalone server that is reachable on the network and sets up
|
309
379
|
an Open Source Chef Server as described [above](#knife-server-bootstrap). You
|
310
380
|
are responsible for providing the server so it could be a physical machine,
|
@@ -462,7 +532,9 @@ Apache License, Version 2.0 (see [LICENSE][license])
|
|
462
532
|
[chef_bootstrap_knife_rb]: https://github.com/fnichol/chef-bootstrap-repo/blob/master/.chef/knife.rb
|
463
533
|
[chef_bootstrap_repo]: https://github.com/fnichol/chef-bootstrap-repo/
|
464
534
|
[docs_knife]: http://docs.opscode.com/config_rb_knife.html
|
535
|
+
[docs_knife_ec2]: http://docs.opscode.com/plugin_knife_ec2.html
|
465
536
|
[jtimberman]: https://github.com/jtimberman
|
537
|
+
[install_chef]: http://www.opscode.com/chef/install/
|
466
538
|
[knife-ec2]: https://github.com/opscode/knife-ec2
|
467
539
|
[stevendanna]: https://github.com/stevendanna
|
468
540
|
[vagrant_site]: http://vagrantup.com/
|
data/knife-server.gemspec
CHANGED
@@ -18,7 +18,8 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.add_dependency "fog", "~> 1.3"
|
19
19
|
gem.add_dependency "net-ssh"
|
20
20
|
gem.add_dependency "chef", ">= 0.10.10"
|
21
|
-
|
21
|
+
|
22
|
+
gem.add_development_dependency "knife-ec2", ">= 0.5.12"
|
22
23
|
|
23
24
|
gem.add_development_dependency "rspec", "~> 2.10"
|
24
25
|
gem.add_development_dependency "fakefs", "~> 0.4.0"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#
|
2
|
+
# Partial: _common.sh
|
3
|
+
#
|
4
|
+
# Common functions used by the rest of the program.
|
5
|
+
#
|
6
|
+
|
7
|
+
banner() { echo "-----> $*" ; }
|
8
|
+
info() { echo " $*" ; }
|
9
|
+
warn() { echo ">>>>>> $*" >&2 ; }
|
10
|
+
|
11
|
+
report_bug() {
|
12
|
+
warn "Please file a bug report at https://github.com/fnichol/knife-server/issues"
|
13
|
+
warn " "
|
14
|
+
warn "Please detail your operating system, version and any other relevant details"
|
15
|
+
}
|
16
|
+
|
17
|
+
exists() {
|
18
|
+
if command -v $1 &>/dev/null
|
19
|
+
then
|
20
|
+
return 0
|
21
|
+
else
|
22
|
+
return 1
|
23
|
+
fi
|
24
|
+
}
|