knife-windows 0.5.4 → 0.5.6

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ Release Notes - Knife Windows Plugin - Version 0.5.6
2
+
3
+ ** New Feature
4
+ * new default bootstrap template that installs Chef using official chef-client MSI installer
5
+
1
6
  Release Notes - Knife Windows Plugin - Version 0.5.4
2
7
 
3
8
  ** Bug
data/README.rdoc CHANGED
@@ -23,7 +23,7 @@ This plugin provides the following Knife subcommands. Specific command options
23
23
  The +winrm+ subcommand allows you to invoke commands in parallel on a subset of the nodes in your infrastructure. The +winrm+ subcommand uses the same syntax as the {search subcommand}[http://wiki.opscode.com/display/chef/Search]; you could could find the uptime of all your web servers using the command:
24
24
 
25
25
  % knife winrm "role:web" "net stats srv" -x Administrator -P 'super_secret_password'
26
-
26
+
27
27
  Or force a chef run:
28
28
 
29
29
  % knife winrm 'ec2-50-xx-xx-124.compute-1.amazonaws.com' 'chef-client -c c:/chef/client.rb' -m -x Administrator -P 'super_secret_password'
@@ -38,7 +38,7 @@ This subcommand operates in a very similar manner as {knife ssh}[http://wiki.ops
38
38
 
39
39
  == knife bootstrap windows winrm
40
40
 
41
- Performs a Chef Bootstrap (via the WinRM protocol) on the target node. The goal of the bootstrap is to get Chef installed on the target system so it can run Chef Client with a Chef Server. The main assumption is a baseline OS installation exists. It is primarily intended for Chef Client systems that talk to a Chef server.
41
+ Performs a Chef Bootstrap (via the WinRM protocol) on the target node. The goal of the bootstrap is to get Chef installed on the target system so it can run Chef Client with a Chef Server. The main assumption is a baseline OS installation exists. It is primarily intended for Chef Client systems that talk to a Chef server.
42
42
 
43
43
  This subcommand operates in a very similar manner as {knife bootstrap}[http://wiki.opscode.com/display/chef/Knife+Bootstrap]...just leveraging the WinRM protocol for communication. An initial run_list for the node can also be passed to the subcommand. Example usage:
44
44
 
@@ -46,7 +46,7 @@ This subcommand operates in a very similar manner as {knife bootstrap}[http://wi
46
46
 
47
47
  == knife bootstrap windows ssh
48
48
 
49
- Performs a Chef Bootstrap (via the SSH protocol) on the target node. The goal of the bootstrap is to get Chef installed on the target system so it can run Chef Client with a Chef Server. The main assumption is a baseline OS installation exists. It is primarily intended for Chef Client systems that talk to a Chef server.
49
+ Performs a Chef Bootstrap (via the SSH protocol) on the target node. The goal of the bootstrap is to get Chef installed on the target system so it can run Chef Client with a Chef Server. The main assumption is a baseline OS installation exists. It is primarily intended for Chef Client systems that talk to a Chef server.
50
50
 
51
51
  This subcommand assumes the SSH session will use Windows native cmd.exe command shell vs a bash shell through an emulated cygwin layer. Most popular Windows based SSHd daemons like {freeSSHd}[http://www.freesshd.com/] and {WinSSHD}[http://www.bitvise.com/winsshd] behave this way.
52
52
 
@@ -58,6 +58,17 @@ An initial run_list for the node can also be passed to the subcommand. Example u
58
58
 
59
59
  This gem provides the following bootstrap templates:
60
60
 
61
+ == windows-chef-client-msi
62
+
63
+ This bootstrap template does the following:
64
+
65
+ * Installs the latest version of Chef (and all dependencies) using the `chef-client` msi.
66
+ * Writes the validation.pem per the local knife configuration.
67
+ * Writes a default config file for Chef (C:\chef\client.rb) using values from the +knife.rb+.
68
+ * Creates a JSON attributes file containing the specified run list and run Chef.
69
+
70
+ This is the default bootstrap template used by both the +windows+ +bootstrap+ subcommands.
71
+
61
72
  == windows-shell
62
73
 
63
74
  This bootstrap template does the following:
@@ -70,7 +81,7 @@ This bootstrap template does the following:
70
81
  * Writes a default config file for Chef (C:\chef\client.rb) using values from the +knife.rb+.
71
82
  * Creates a JSON attributes file containing the specified run list and run Chef.
72
83
 
73
- This is the default bootstrap template used by both the +windows+ +bootstrap+ subcommands.
84
+ This should be considered a legacy bootstrap template and will most likely be removed in a future version.
74
85
 
75
86
  = REQUIREMENTS/SETUP:
76
87
 
@@ -85,7 +96,7 @@ Knife plugins require >= Chef 0.10. More details about Knife plugins can be {fo
85
96
  A server running WinRM must also be configured properly to allow outside connections and the entire network path from the knife workstation to the server. The easiest way to accomplish this is to use {WinRM's quick configuration option}[http://msdn.microsoft.com/en-us/library/aa384372(v=vs.85).aspx#quick_default_configuration]:
86
97
 
87
98
  C:\Users\Administrator> winrm quickconfig -q
88
-
99
+
89
100
  The Chef and Ohai gem installations (that occur during bootstrap) take more memory than the default 150MB WinRM allocates per shell. Bump it up to 300MB with the following setting:
90
101
 
91
102
  C:\Users\Administrator> winrm set winrm/config/winrs @{MaxMemoryPerShellMB="300"}
@@ -117,4 +128,4 @@ Unless required by applicable law or agreed to in writing, software
117
128
  distributed under the License is distributed on an "AS IS" BASIS,
118
129
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
119
130
  See the License for the specific language governing permissions and
120
- limitations under the License.
131
+ limitations under the License.
@@ -0,0 +1,48 @@
1
+ @rem
2
+ @rem Author:: Seth Chisamore (<schisamo@opscode.com>)
3
+ @rem Copyright:: Copyright (c) 2011 Opscode, Inc.
4
+ @rem License:: Apache License, Version 2.0
5
+ @rem
6
+ @rem Licensed under the Apache License, Version 2.0 (the "License");
7
+ @rem you may not use this file except in compliance with the License.
8
+ @rem You may obtain a copy of the License at
9
+ @rem
10
+ @rem http://www.apache.org/licenses/LICENSE-2.0
11
+ @rem
12
+ @rem Unless required by applicable law or agreed to in writing, software
13
+ @rem distributed under the License is distributed on an "AS IS" BASIS,
14
+ @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ @rem See the License for the specific language governing permissions and
16
+ @rem limitations under the License.
17
+ @rem
18
+
19
+ <%= "SETX HTTP_PROXY \"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] %>
20
+ mkdir C:\chef
21
+
22
+ > C:\chef\wget.vbs (
23
+ <%= win_wget %>
24
+ )
25
+
26
+ @rem Install Chef using chef-client MSI installer
27
+ cscript /nologo C:\chef\wget.vbs /url:http://s3.amazonaws.com/opscode-full-stack/windows/chef-client-0.10.4-6.msi /path:%TEMP%\chef-client-0.10.4-6.msi
28
+ msiexec /qb /i %TEMP%\chef-client-0.10.4-6.msi
29
+
30
+ > C:\chef\validation.pem (
31
+ <%= validation_key %>
32
+ )
33
+
34
+ <% if @config[:encrypted_data_bag_secret] -%>
35
+ > C:\chef\encrypted_data_bag_secret (
36
+ <%= encrypted_data_bag_secret %>
37
+ )
38
+ <% end -%>
39
+
40
+ > C:\chef\client.rb (
41
+ <%= config_content %>
42
+ )
43
+
44
+ > C:\chef\first-boot.json (
45
+ <%= run_list %>
46
+ )
47
+
48
+ <%= start_chef %>
@@ -31,14 +31,19 @@ cscript /nologo C:\chef\wget.vbs /url:http://cloud.github.com/downloads/oneclick
31
31
  mkdir C:\DevKit
32
32
  copy %TEMP%\rubydevkit.exe C:\DevKit
33
33
  cmd.exe /C C:\DevKit\rubydevkit.exe -y
34
- cmd.exe /C C:\ruby\bin\ruby c:/DevKit/dk.rb init
35
- cmd.exe /C C:\ruby\bin\ruby c:/DevKit/dk.rb install
36
34
 
37
- cmd.exe /C C:\ruby\bin\gem install win32-open3 rdp-ruby-wmi windows-api windows-pr --no-rdoc --no-ri --verbose
35
+ @rem update path during bootstrap session
36
+ SET PATH=%PATH%;C:\ruby\bin
37
+
38
+ cmd.exe /C ruby c:/DevKit/dk.rb init
39
+ cmd.exe /C ruby c:/DevKit/dk.rb install
40
+
41
+ cmd.exe /C gem install win32-api win32-service --platform=mswin32
42
+ cmd.exe /C gem install win32-open3 rdp-ruby-wmi windows-api windows-pr --no-rdoc --no-ri --verbose
38
43
 
39
44
  @rem Install Chef gems separately to prevent 'failed to allocate memory' errors
40
- cmd.exe /C C:\ruby\bin\gem install ohai --no-rdoc --no-ri --verbose
41
- cmd.exe /C C:\ruby\bin\gem install chef --no-rdoc --no-ri --verbose <%= bootstrap_version_string %>
45
+ cmd.exe /C gem install ohai --no-rdoc --no-ri --verbose
46
+ cmd.exe /C gem install chef --no-rdoc --no-ri --verbose <%= bootstrap_version_string %>
42
47
 
43
48
  > C:\chef\validation.pem (
44
49
  <%= validation_key %>
@@ -57,7 +57,7 @@ class Chef
57
57
  :short => "-d DISTRO",
58
58
  :long => "--distro DISTRO",
59
59
  :description => "Bootstrap a distro using a template",
60
- :default => "windows-shell"
60
+ :default => "windows-chef-client-msi"
61
61
 
62
62
  option :template_file,
63
63
  :long => "--template-file TEMPLATE",
@@ -135,7 +135,7 @@ class Chef
135
135
  # create a bootstrap.bat file on the node
136
136
  # we have to run the remote commands in 2047 char chunks
137
137
  create_bootstrap_bat_command do |command_chunk, chunk_num|
138
- run_command("cmd.exe /C echo \"Rendering bootstrap.bat chunk #{chunk_num}\" && #{command_chunk}").run
138
+ run_command("cmd.exe /C echo \"Rendering '#{bootstrap_bat_file}' chunk #{chunk_num}\" && #{command_chunk}").run
139
139
  end
140
140
 
141
141
  # execute the bootstrap.bat file
@@ -163,7 +163,7 @@ class Chef
163
163
  end
164
164
 
165
165
  def bootstrap_bat_file
166
- "%TEMP%\\bootstrap.bat"
166
+ @bootstrap_bat_file ||= "%TEMP%\\bootstrap-#{Process.pid}-#{Time.now.to_i}.bat"
167
167
  end
168
168
 
169
169
  def locate_config_value(key)
@@ -172,4 +172,4 @@ class Chef
172
172
  end
173
173
  end
174
174
  end
175
- end
175
+ end
@@ -79,7 +79,8 @@ CONFIG
79
79
  end
80
80
 
81
81
  def start_chef
82
- "c:/ruby/bin/ruby c:/ruby/bin/chef-client -c c:/chef/client.rb -j c:/chef/first-boot.json -E #{bootstrap_environment}"
82
+ start_chef = "SET PATH=%PATH%;C:\\ruby\\bin;C:\\opscode\\chef\\bin;C:\\opscode\\chef\\embedded\\bin\n"
83
+ start_chef << "chef-client -c c:/chef/client.rb -j c:/chef/first-boot.json -E #{bootstrap_environment}\n"
83
84
  end
84
85
 
85
86
  def run_list
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Windows
3
- VERSION = "0.5.4"
3
+ VERSION = "0.5.6"
4
4
  MAJOR, MINOR, TINY = VERSION.split('.')
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,40 +1,37 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: knife-windows
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.6
4
5
  prerelease:
5
- version: 0.5.4
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Seth Chisamore
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-08-12 00:00:00 -04:00
14
- default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
12
+ date: 2011-10-24 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
17
15
  name: em-winrm
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70211127012580 !ruby/object:Gem::Requirement
20
17
  none: false
21
- requirements:
22
- - - "="
23
- - !ruby/object:Gem::Version
18
+ requirements:
19
+ - - =
20
+ - !ruby/object:Gem::Version
24
21
  version: 0.5.2
25
22
  type: :runtime
26
- version_requirements: *id001
27
- description: Plugin that adds functionality to Chef's Knife CLI for configuring/interacting with nodes running Microsoft Windows
28
- email:
23
+ prerelease: false
24
+ version_requirements: *70211127012580
25
+ description: Plugin that adds functionality to Chef's Knife CLI for configuring/interacting
26
+ with nodes running Microsoft Windows
27
+ email:
29
28
  - schisamo@opscode.com
30
29
  executables: []
31
-
32
30
  extensions: []
33
-
34
- extra_rdoc_files:
31
+ extra_rdoc_files:
35
32
  - README.rdoc
36
33
  - LICENSE
37
- files:
34
+ files:
38
35
  - .gitignore
39
36
  - CHANGELOG
40
37
  - Gemfile
@@ -42,6 +39,7 @@ files:
42
39
  - README.rdoc
43
40
  - Rakefile
44
41
  - knife-windows.gemspec
42
+ - lib/chef/knife/bootstrap/windows-chef-client-msi.erb
45
43
  - lib/chef/knife/bootstrap/windows-shell.erb
46
44
  - lib/chef/knife/bootstrap_windows_base.rb
47
45
  - lib/chef/knife/bootstrap_windows_ssh.rb
@@ -50,33 +48,29 @@ files:
50
48
  - lib/chef/knife/winrm.rb
51
49
  - lib/chef/knife/winrm_base.rb
52
50
  - lib/knife-windows/version.rb
53
- has_rdoc: true
54
51
  homepage: https://github.com/opscode/knife-windows
55
52
  licenses: []
56
-
57
53
  post_install_message:
58
54
  rdoc_options: []
59
-
60
- require_paths:
55
+ require_paths:
61
56
  - lib
62
- required_ruby_version: !ruby/object:Gem::Requirement
57
+ required_ruby_version: !ruby/object:Gem::Requirement
63
58
  none: false
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
67
62
  version: 1.9.1
68
- required_rubygems_version: !ruby/object:Gem::Requirement
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
64
  none: false
70
- requirements:
71
- - - ">="
72
- - !ruby/object:Gem::Version
73
- version: "0"
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
74
69
  requirements: []
75
-
76
70
  rubyforge_project:
77
- rubygems_version: 1.6.2
71
+ rubygems_version: 1.8.6
78
72
  signing_key:
79
73
  specification_version: 3
80
- summary: Plugin that adds functionality to Chef's Knife CLI for configuring/interacting with nodes running Microsoft Windows
74
+ summary: Plugin that adds functionality to Chef's Knife CLI for configuring/interacting
75
+ with nodes running Microsoft Windows
81
76
  test_files: []
82
-