knife-zero 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe277e202a431b5550d53d94a074b05f2b9bfdc3
4
- data.tar.gz: fdfb3c66fa15928b6ad189d711d7a9f235e09126
3
+ metadata.gz: 9428bb82b40f0180558a18b4a6b0e95da130844e
4
+ data.tar.gz: 9cfc0156d65267003e9887ca0765715b969eacbc
5
5
  SHA512:
6
- metadata.gz: 8d683f8f4c1368c6abc7d85fc7cf02b3ecd2bd3fdab2f69a432ee8f267d97109b2c4a80fd5c9606c6c86574c57c319d47aaaabac40bc06e554eeb2e26af63e97
7
- data.tar.gz: 1f2c039b2f8295bc2b0c0a368476553c3f03167895c3ea3975c4d4e3fa3789a2320cd5a49d17b73cd5ad1c0d7dac2f42c75a6d8e0621550967aacf9065999a7c
6
+ metadata.gz: d26d675ca419769bbed6a0715c54203dba8089bb70683ff78431a808497a9b7227f0d8a650f2b19f613a167a8f31222b06234e8c25bb7b850433e2bd7e25258e
7
+ data.tar.gz: 8280fd3fc1dd62776acef4bdbced118222943446ea6fac9d3d733e5fabfaba44aea7062b277bd04c379fafa15c6fa3cae27bdc1b25cee4c128ac1765645927d9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog of knife-zero
2
2
 
3
+ ## v1.1.4
4
+
5
+ - Feature: support ssh/config on bootstrapping.
6
+
3
7
  ## v1.1.3
4
8
 
5
9
  - Feature: allow plural bootstrapping
data/README.md CHANGED
@@ -102,12 +102,6 @@ Platform: ubuntu 12.04
102
102
  Tags:
103
103
  ```
104
104
 
105
- Search and update node by `knife exec`(I will implement them into plugin.).
106
-
107
- ```
108
- $ knife exec --local-mode -E 'nodes.all {|n| system "ssh -R8889:127.0.0.1:8889 #{n.ipaddress} chef-client -S http://127.0.0.1:8889" }'
109
- ```
110
-
111
105
  Seach and execute command via ssh by knife ssh.
112
106
 
113
107
  ```
@@ -116,6 +110,13 @@ xxx.xxx.xxx.xxx 08:41:36 up 1:03, 1 user, load average: 0.00, 0.01, 0.01
116
110
  xxx.xxx.xxx.xxx 08:41:37 up 143 days, 2:32, 4 users, load average: 0.00, 0.01, 0.05
117
111
  ```
118
112
 
113
+ Bootstrap multi-nodes via GNU Parallel
114
+
115
+ ```
116
+ $ parallel -j 5 ./bin/knife zero bootstrap ::: nodeA nodeB nodeC...
117
+ ```
118
+
119
+
119
120
  ### knife zero chef_client (for update)
120
121
 
121
122
  `knife zero chef_client QUERY (options)`
@@ -191,6 +192,149 @@ You can test cookbooks easily by Test-Kitchen before manage remote nodes instead
191
192
 
192
193
  See [Getting Started knife-zero with test-kitchen](https://github.com/higanworks/knife-zero-with-kitchen).
193
194
 
195
+ ### Or, Try knife-zero simply with Vagrant.
196
+
197
+ Set local_mode as default to `knfie.rb`.
198
+
199
+ ```
200
+ $ echo 'local_mode true' >> knife.rb
201
+ ```
202
+
203
+ Add host-only network to vagrant vm(strongly recommended).
204
+
205
+ ```
206
+ Vagrant.configure(2) do |config|
207
+ config.vm.box = "opscode-ubuntu-14.04"
208
+ config.vm.network "private_network", ip: "192.168.33.10"
209
+ end
210
+ ```
211
+
212
+
213
+ Retrieve ssh-config.
214
+
215
+ ```
216
+ $ vagrant up
217
+ $ vagrant ssh-config
218
+ Host default
219
+ HostName 127.0.0.1
220
+ User vagrant
221
+ Port 2201
222
+ UserKnownHostsFile /dev/null
223
+ StrictHostKeyChecking no
224
+ PasswordAuthentication no
225
+ IdentityFile /Users/sawanoboriyu/worktemp/knife-zero-vagrant/.vagrant/machines/default/virtualbox/private_key
226
+ IdentitiesOnly yes
227
+ LogLevel FATAL
228
+ ```
229
+
230
+ #### Case: Use name as address for ssh
231
+
232
+ Bootstrap with ssh options and `--sudo` to host-only address. And set ipaddress to name with `-N` option.
233
+
234
+ ```
235
+ $ ./bin/knife zero bootstrap 192.168.33.10 -i ./.vagrant/machines/default/virtualbox/private_key -N 192.168.33.10 -x vagrant --sudo
236
+
237
+ WARN: No cookbooks directory found at or above current directory. Assuming /Users/sawanoboriyu/worktemp/knife-zero-vagrant.
238
+ Connecting to 192.168.33.10
239
+ 192.168.33.10 Installing Chef Client...
240
+
241
+ ...
242
+ ```
243
+
244
+ Run zero chef_client with `-a name` option.
245
+
246
+ ```
247
+ $ knife zero chef_client "name:*" -x vagrant -i ./.vagrant/machines/default/virtualbox/private_key --sudo -a name
248
+ WARN: No cookbooks directory found at or above current directory. Assuming /Users/sawanoboriyu/worktemp/knife-zero-vagrant.
249
+ 192.168.33.10 Starting Chef Client, version 12.0.3
250
+ 192.168.33.10 resolving cookbooks for run list: []
251
+ 192.168.33.10 Synchronizing Cookbooks:
252
+ 192.168.33.10 Compiling Cookbooks...
253
+ 192.168.33.10 [2015-02-04T04:08:04+00:00] WARN: Node 192.168.33.10 has an empty run list.
254
+ 192.168.33.10 Converging 0 resources
255
+ 192.168.33.10
256
+ 192.168.33.10 Running handlers:
257
+ 192.168.33.10 Running handlers complete
258
+ 192.168.33.10 Chef Client finished, 0/0 resources updated in 6.571334535 seconds
259
+ ...
260
+ ```
261
+
262
+ #### Case: Set specific attribute for ssh
263
+
264
+ Bootstrap with ssh options and `--sudo` to host-only address.
265
+
266
+ ```
267
+ $ knife zero bootstrap 192.168.33.10 -i ./.vagrant/machines/default/virtualbox/private_key -x vagrant --sudo
268
+
269
+ WARN: No cookbooks directory found at or above current directory. Assuming /Users/sawanoboriyu/worktemp/knife-zero-vagrant.
270
+ Connecting to 192.168.33.10
271
+ 192.168.33.10 Installing Chef Client...
272
+ 192.168.33.10 --2015-02-03 16:44:56-- https://www.opscode.com/chef/install.sh
273
+ 192.168.33.10 Resolving www.opscode.com (www.opscode.com)... 184.106.28.91
274
+ 192.168.33.10 Connecting to www.opscode.com (www.opscode.com)|184.106.28.91|:443... connected.
275
+ 192.168.33.10 HTTP request sent, awaiting response... 200 OK
276
+ 192.168.33.10 Length: 18285 (18K) [application/x-sh]
277
+ 192.168.33.10 Saving to: ‘STDOUT’
278
+ 192.168.33.10
279
+ 100%[======================================>] 18,285 --.-K/s in 0.002s
280
+ ...
281
+ ```
282
+
283
+ You can see node which was bootstrapped at list.
284
+
285
+ ```
286
+ $ knife node list
287
+
288
+ vagrant.vm
289
+ ```
290
+
291
+ Set unique attribute to node by `node edit`, such as `chef_ip`.
292
+
293
+ ```
294
+ $ knife node edit vagrant.vm
295
+ {
296
+ "name": "vagrant.vm",
297
+ "chef_environment": "_default",
298
+ "normal": {
299
+ "chef_ip" : "192.168.33.10",
300
+ "tags": [
301
+
302
+ ]
303
+ },
304
+ "run_list": [
305
+
306
+ ]
307
+
308
+ }
309
+ ```
310
+
311
+ Run zero chef_client with `-a chef_ip` option.
312
+
313
+ ```
314
+ $ ./bin/knife zero chef_client "name:vagrant.vm" -x vagrant -i ./.vagrant/machines/default/virtualbox/private_key --sudo -a chef_ip
315
+
316
+ 192.168.33.10 Starting Chef Client, version 12.0.3
317
+ 192.168.33.10 resolving cookbooks for run list: []
318
+ 192.168.33.10 Synchronizing Cookbooks:
319
+ 192.168.33.10 Compiling Cookbooks...
320
+ 192.168.33.10 [2015-02-03T17:03:37+00:00] WARN: Node vagrant.vm has an empty run list.
321
+ 192.168.33.10 Converging 0 resources
322
+ 192.168.33.10
323
+ 192.168.33.10 Running handlers:
324
+ 192.168.33.10 Running handlers complete
325
+ 192.168.33.10 Chef Client finished, 0/0 resources updated in 6.245413202 seconds
326
+ ```
327
+
328
+ #### Case: don't use name or specific attribute..?
329
+
330
+ For example, you can use ipv4 of eth1(or others) like below.
331
+
332
+ ```
333
+ $ knife zero chef_client "name:*" -x vagrant -i ./.vagrant/machines/default/virtualbox/private_key --sudo -a network.interfaces.eth1.addresses.keys.rotate.first
334
+
335
+ 192.168.33.10 Starting Chef Client, version 12.0.3
336
+ 192.168.33.10 resolving cookbooks for run list: []
337
+ ```
194
338
 
195
339
  ## Contributing
196
340
 
@@ -117,6 +117,7 @@ class Chef
117
117
  ssh = Chef::Knife::BootstrapSsh.new
118
118
  ssh.ui = ui
119
119
  ssh.name_args = [ server_name, ssh_command ]
120
+ ssh.config = Net::SSH.configuration_for(server_name)
120
121
  ssh.config[:ssh_user] = Chef::Config[:knife][:ssh_user] || config[:ssh_user]
121
122
  ssh.config[:ssh_password] = config[:ssh_password]
122
123
  ssh.config[:ssh_port] = Chef::Config[:knife][:ssh_port] || config[:ssh_port]
@@ -126,6 +127,7 @@ class Chef
126
127
  ssh.config[:manual] = true
127
128
  ssh.config[:host_key_verify] = Chef::Config[:knife][:host_key_verify] || config[:host_key_verify]
128
129
  ssh.config[:on_error] = :raise
130
+ puts ssh.config
129
131
  ssh
130
132
  end
131
133
  end
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Zero
3
- VERSION = "1.1.3"
3
+ VERSION = "1.1.4"
4
4
  MAJOR, MINOR, TINY = VERSION.split('.')
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-zero
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - sawanoboly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-26 00:00:00.000000000 Z
11
+ date: 2015-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler