knife-zero 1.8.7 → 1.9.0.pre.1

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: 23d02b4ab827fdc2d4b0a9b82e30177b0694a9f2
4
- data.tar.gz: 9428d56194ca579503718e9517f4dbd9b696dac7
3
+ metadata.gz: c2c620c6d5a45dcd31d20e1ad79a5aad1bef3eb3
4
+ data.tar.gz: 5025abfbbab7bb134613ee7322853db13661b777
5
5
  SHA512:
6
- metadata.gz: cab667682f056eb055fa6cf1a464f70da24dc935f6bcc253121d9b3072dccf26e4f8e0e13463954da39876c5a8206778d306cb75bdd0329bac19efea11fde950
7
- data.tar.gz: 08ef833e2df63ac66064974bba5ab50320d3449b9050df2b237656294e8bfd2f6955428f6e470255c1fe5d40dbdb6610f68142dec433f53d6b66299b46680442
6
+ metadata.gz: ca4447936565588d7d77c6b21db8bd23295af94e2622116aad2a74154efb2ebd4fc4bd14dc373b303b6ccd3d57923699b6f9eacaec406a8b3f2e1c1bebc701e4
7
+ data.tar.gz: 2a5f49c88167802ffc2321ae3bbe539734b73237e39fa5634ba63776745eced1a7e71a39f0fe91820fdb0edaafd5d9f5e4b194463467bb5aeca7771c28d3ff61
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## v1.9.0
6
+
7
+ - Change: use nil to ssh_user on bootstraping by default.
8
+ - compatibility for 12.5 and ssh/config
9
+ - Remove: add new attribute knife_zero.ssh_url at bootstrap.
10
+
5
11
  ## v1.8.7
6
12
 
7
13
  - Follow master: environment _default is not set by default since 12.5
data/README.md CHANGED
@@ -40,283 +40,25 @@ knife zero diagnose # show configuration from file
40
40
 
41
41
  ### Configuration file
42
42
 
43
- You need to make sure the knife.rb file in your chef-repo (in the chef-repo root or .chef directory) is adapted to use chef-zero.
43
+ Relocated: [Configration | Knife-Zero Document](http://knife-zero.github.io/40_configration/)
44
44
 
45
- For example, at `.chef/knife.rb`. At least the following contents are needed:
46
- ```
47
- chef_repo_path File.expand_path('../../' , __FILE__)
48
- cookbook_path [File.expand_path('../../cookbooks' , __FILE__), File.expand_path('../../site-cookbooks' , __FILE__)]
49
- ```
50
-
51
- If you used knife serve or knife zero, this makes sure chef-zero is started with the contents of the chef-repo directory instead of as an empty server.
52
-
53
- ### knife zero bootstrap
54
-
55
- Install Chef to remote node and run chef-client under chef-zero via tcp-forward.
56
-
57
- Supported options are mostly the same as `knife bootstrap`.
58
- And it supports why-run(`-W, --why-run`)and Bootstrap without first Chef-Client Run.(--no-converge).
59
-
60
- #### Example
61
-
62
- Bootstrap with run-list.
63
-
64
- ```
65
- $ bundle exec knife zero bootstrap host.example.com -r hogehoge::default --no-host-key-verify
66
- Connecting to host.example.com
67
- host.example.com Installing Chef Client...
68
- -- snip --
69
- host.example.com Thank you for installing Chef!
45
+ ### knife zero bootstrap | converge | diagnose
70
46
 
71
- host.example.com Starting first Chef Client run...
72
- host.example.com Starting Chef Client, version 11.14.6
73
- host.example.com Creating a new client identity for host.example.com using the validator key.
47
+ Relocated
74
48
 
49
+ - [Getting Started | Knife-Zero Document](http://knife-zero.github.io/20_getting_started/)
50
+ - [Subcommands | Knife-Zero Document](http://knife-zero.github.io/30_subcommands/)
75
51
 
76
- ## Resolve and sync cookbook via http over ssh tcp-forward by run-list.
77
- host.example.com resolving cookbooks for run list: ["hogehoge::default"]
78
- host.example.com Synchronizing Cookbooks:
79
- host.example.com - hogehoge
80
- host.example.com Compiling Cookbooks...
81
- host.example.com Converging 0 resources
82
- host.example.com
83
- host.example.com Running handlers:
84
- host.example.com Running handlers complete
85
- host.example.com Chef Client finished, 0/0 resources updated in 4.895561879 seconds
86
-
87
-
88
- ## Creates node object into local.
89
- $ ls nodes/host.example.com.json
90
- nodes/host.example.com.json
91
- host.example.com
92
-
93
- ## Search by knife with --local--mode option.
94
- $ bundle exec knife search node --local-mode
95
- 1 items found
96
-
97
- Node Name: host.example.com
98
- Environment: _default
99
- FQDN:
100
- IP: xxx.xxx.xxx.xxx
101
- Run List: recipe[hogehoge::default]
102
- Roles:
103
- Recipes: hogehoge::default
104
- Platform: ubuntu 12.04
105
- Tags:
106
- ```
107
-
108
- Search and execute command via ssh by knife ssh.
109
-
110
- ```
111
- $ knife ssh 'hostname:*' --local-mode uptime --attribute ipaddress
112
- xxx.xxx.xxx.xxx 08:41:36 up 1:03, 1 user, load average: 0.00, 0.01, 0.01
113
- xxx.xxx.xxx.xxx 08:41:37 up 143 days, 2:32, 4 users, load average: 0.00, 0.01, 0.05
114
- ```
115
-
116
- Bootstrap multi-nodes via GNU Parallel
117
-
118
- ```
119
- $ parallel -j 5 ./bin/knife zero bootstrap ::: nodeA nodeB nodeC...
120
- ```
121
52
 
122
53
  #### (Hint)Supress Automatic Attributes
123
54
 
124
- knife-zero supports appending [whitelist-attributes](https://docs.chef.io/attributes.html#whitelist-attributes) to client.rb at bootstrap.
125
-
126
- For example, set array to `knife.rb`.
127
-
128
- ```
129
- knife[:automatic_attribute_whitelist] = [
130
- "fqdn/",
131
- "ipaddress/",
132
- "roles/",
133
- "recipes/",
134
- "ipaddress/",
135
- "platform/",
136
- "platform_version/",
137
- "cloud/",
138
- "cloud_v2/"
139
- ]
140
- ```
141
-
142
- It setting will append to client.rb of node via bootstrap.
143
-
144
- ```
145
- ...
146
-
147
- automatic_attribute_whitelist ["fqdn/", "ipaddress/", "roles/", "recipes/", "ipaddress/", "platform/", "platform_version/", "cloud/", "cloud_v2/"]
148
- ```
149
-
150
- It means knife-zero will collects and updates only listed attributes to local file.
151
-
152
- ```
153
- {
154
- "name": "knife-zero.example.com",
155
- "normal": {
156
- "knife_zero" : {
157
- "host" : "xxx.xxx.xxx.xxx(bootstraped_target)"
158
- },
159
- "tags": [
160
-
161
- ]
162
- },
163
- "automatic": {
164
- "ipaddress": "xxx.xxx.xxx.xxx",
165
- "roles": [
166
-
167
- ],
168
- "recipes": [
169
-
170
- ],
171
- "platform": "ubuntu",
172
- "platform_version": "14.04",
173
- "cloud_v2": null
174
- }
175
- }
176
- ```
177
-
178
-
179
-
180
- ### knife zero converge/chef_client (for update)
181
-
182
- `knife zero converge QUERY (options)`
183
- `knife zero chef_client QUERY (options) | It's same as converge`
184
-
185
- Search nodes from local chef-repo directory, and run chef-client at remote node.
186
-
187
- Supported options are mostly the same as `knife ssh`.
188
- And it supports below.
189
-
190
- - why-run(`-W, --why-run`)
191
- - Override run-list(`-o RunlistItem,RunlistItem, --override-runlist`). It skips save node.json on workstation.
192
-
193
- #### Example
194
-
195
- ```
196
- ## Chef-Repo has two nodes
197
- $ knife node list --local-mode
198
- host.example.com
199
- host2.example.com
200
-
201
- ## add recipe to run_list of host.example.com
202
- $ knife node run_list add host.example.com hogehoge::default --local-mode
203
- host.example.com:
204
- run_list: recipe[hogehoge::default]
205
-
206
-
207
- $ knife zero converge 'name:*' --attribute ipaddress
208
-
209
- ## host.example.com was converged by run_list.
210
- host.example.com Starting Chef Client, version 11.14.6
211
- host.example.com resolving cookbooks for run list: ["hogehoge::default"]
212
- host.example.com Synchronizing Cookbooks:
213
- host.example.com - hogehoge
214
- host.example.com Compiling Cookbooks...
215
- host.example.com Converging 0 resources
216
- host.example.com
217
- host.example.com Running handlers:
218
- host.example.com Running handlers complete
219
- host.example.com Chef Client finished, 0/0 resources updated in 3.112708185 seconds
220
-
221
-
222
- ## host2.example.com has no run_list.
223
- host2.example.com Starting Chef Client, version 11.14.2
224
- host2.example.com resolving cookbooks for run list: []
225
- host2.example.com Synchronizing Cookbooks:
226
- host2.example.com Compiling Cookbooks...
227
- host2.example.com [2014-08-24T11:52:15+00:00] WARN: Node ngrok01.xenzai.net has an empty run list.
228
- host2.example.com Converging 0 resources
229
- host2.example.com
230
- host2.example.com Running handlers:
231
- host2.example.com Running handlers complete
232
- host2.example.com Chef Client finished, 0/0 resources updated in 3.729471856 seconds
233
- ```
234
-
235
-
236
- ## Sample Workflow
237
-
238
- 1. create chef-repo directory.
239
- 1. bundle init and add below.
240
- - `gem 'chef' `
241
- - `gem 'knife-zero'`
242
- - and cookbook management tool such as `Berkshelf` or `Librarian-Chef`.
243
- 1. bundle
244
- e.g.) `bundle install --path vendor/bundle --binstubs`
245
- 1. install cookbooks to `./cookbooks`. (if you need run recipe.)
246
- 1. bootstrap on remote node.
247
- `./bin/knife zero bootstrap host.example.com [-r "${your-run-list}"]`
248
- 1. chef-client will run using resources on local chef-repo.
249
-
250
- ### Need test on Vagrant ?
251
-
252
- Relocated: [Practice with Vagrant | Knife-Zero Document](https://knife-zero.github.io/tips/practice_with_vagrant/)
253
-
254
-
255
- ## Debug for Configuration
256
-
257
- `knife zero diagnose` shows configuration from file(Such as knife.rb).
258
-
259
- ```
260
- $ knife zero diagnose
261
-
262
- Chef::Config
263
- ====================
264
- ---
265
- :local_mode: true
266
- :verbosity:
267
- :config_file: "/Users/sawanoboriyu/github/higanworks/knife-zero_playground/knife.rb"
268
- :color: true
269
- :log_level: :error
270
- :chef_repo_path: "/Users/sawanoboriyu/github/higanworks/knife-zero_playground"
271
- :log_location: !ruby/object:IO {}
272
- :chef_server_url: http://localhost:8889
273
- :repo_mode: everything
274
-
275
- Knife::Config
276
- ====================
277
- ---
278
- :verbosity: 0
279
- :color: true
280
- :editor: vim
281
- :disable_editing: false
282
- :format: summary
283
- :ssh_user: root
284
- :host_key_verify: true
285
- :config_file: "/Users/sawanoboriyu/github/higanworks/knife-zero_playground/knife.rb"
286
-
287
- Zero Bootstrap Config
288
- ====================
289
- ---
290
- :ssh_user: root
291
- :host_key_verify: true
292
- :distro: chef-full-localmode
293
- :template_file: false
294
- :run_list: []
295
- :first_boot_attributes: {}
296
-
297
- Zero ChefClient Config
298
- ====================
299
- ---
300
- :ssh_user: root
301
- :host_key_verify: true
302
- :concurrency:
303
- :override_runlist:
304
- ```
55
+ Relocated: [Configration | Knife-Zero Document](http://knife-zero.github.io/40_configration/)
305
56
 
306
57
 
307
58
  ## To include from other knife plugins
308
59
 
309
- If you want to integrate knife-zero on machine creation with cloud plugins, you can add zerobootstrap to deps like below.
310
-
311
- ```
312
- deps do
313
- require 'chef/knife/zerobootstrap'
314
- Chef::Knife::ZeroBootstrap.load_deps
315
- self.options = Chef::Knife::ZeroBootstrap.options.merge(self.options)
316
- end
317
- ```
60
+ Relocated: [To include from other knife plugins | Knife-Zero Document](http://knife-zero.github.io/tips/include_from_other_knife_plugins/)
318
61
 
319
- For example, [knife-digital_ocean](https://github.com/higanworks/knife-digital_ocean/blob/79_merge_zero_bootstrap_options/lib/chef/knife/digital_ocean_droplet_create.rb)
320
62
 
321
63
  ## Contributing
322
64
 
@@ -19,6 +19,11 @@ class Chef
19
19
  self.options.delete :node_ssl_verify_mode
20
20
  self.options.delete :node_verify_api_cert
21
21
 
22
+ ## Override to use nil by default
23
+ option :ssh_user,
24
+ :short => "-x USERNAME",
25
+ :long => "--ssh-user USERNAME"
26
+
22
27
  option :bootstrap_converge,
23
28
  :long => "--[no-]converge",
24
29
  :description => "Bootstrap without Chef-Client Run.(for only update client.rb)",
@@ -80,17 +85,18 @@ class Chef
80
85
  end
81
86
 
82
87
  def build_knifezero_attributes_for_node
83
- ssh_url = String.new("ssh://")
84
- ssh_url << config[:ssh_user] || Chef::Config[:knife][:ssh_user]
85
- ssh_url << "@"
86
- ssh_url << server_name
87
- ssh_url << ":"
88
- port = config[:ssh_port] || Chef::Config[:knife][:ssh_port] || 22
89
- ssh_url << port.to_s
88
+ ## Return to Pending.
89
+ # ssh_url = String.new("ssh://")
90
+ # ssh_url << config[:ssh_user] || Chef::Config[:knife][:ssh_user]
91
+ # ssh_url << "@"
92
+ # ssh_url << server_name
93
+ # ssh_url << ":"
94
+ # port = config[:ssh_port] || Chef::Config[:knife][:ssh_port] || 22
95
+ # ssh_url << port.to_s
90
96
  attr = Mash.new
91
97
  attr[:knife_zero] = {
92
- host: server_name,
93
- ssh_url: ssh_url
98
+ host: server_name
99
+ # ssh_url: ssh_url
94
100
  }
95
101
  attr
96
102
  end
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Zero
3
- VERSION = "1.8.7"
3
+ VERSION = "1.9.0.pre.1"
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.8.7
4
+ version: 1.9.0.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - sawanoboly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-05 00:00:00.000000000 Z
11
+ date: 2015-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -186,9 +186,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
186
186
  version: '0'
187
187
  required_rubygems_version: !ruby/object:Gem::Requirement
188
188
  requirements:
189
- - - ">="
189
+ - - ">"
190
190
  - !ruby/object:Gem::Version
191
- version: '0'
191
+ version: 1.3.1
192
192
  requirements: []
193
193
  rubyforge_project:
194
194
  rubygems_version: 2.4.8