spiceweasel 0.9.0 → 0.9.1
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/README.md +33 -4
- data/lib/spiceweasel/node_list.rb +11 -0
- data/lib/spiceweasel/recipe_list.rb +40 -0
- data/lib/spiceweasel/version.rb +1 -1
- metadata +11 -10
data/README.md
CHANGED
@@ -36,6 +36,7 @@ environments:
|
|
36
36
|
|
37
37
|
roles:
|
38
38
|
- base:
|
39
|
+
- iisserver:
|
39
40
|
- monitoring:
|
40
41
|
- webserver:
|
41
42
|
|
@@ -64,6 +65,12 @@ nodes:
|
|
64
65
|
- rackspace 3:
|
65
66
|
- recipe[mysql],role[monitoring]
|
66
67
|
- --image 49 --flavor 2
|
68
|
+
- windows_winrm winboxA:
|
69
|
+
- role[base],role[iisserver]
|
70
|
+
- -x Administrator -P 'super_secret_password'
|
71
|
+
- windows_ssh winboxB winboxC:
|
72
|
+
- role[base],role[iisserver]
|
73
|
+
- -x Administrator -P 'super_secret_password'
|
67
74
|
```
|
68
75
|
|
69
76
|
JSON
|
@@ -91,6 +98,7 @@ From the `example.json`:
|
|
91
98
|
"roles":
|
92
99
|
[
|
93
100
|
{"base":[]},
|
101
|
+
{"iisserver":[]},
|
94
102
|
{"monitoring":[]},
|
95
103
|
{"webserver":[]}
|
96
104
|
],
|
@@ -141,6 +149,18 @@ From the `example.json`:
|
|
141
149
|
"recipe[mysql],role[monitoring]",
|
142
150
|
"--image 49 --flavor 2"
|
143
151
|
]
|
152
|
+
},
|
153
|
+
{"windows_winrm winboxA":
|
154
|
+
[
|
155
|
+
"role[base],role[iisserver]",
|
156
|
+
"-x Administrator -P 'super_secret_password'"
|
157
|
+
]
|
158
|
+
},
|
159
|
+
{"windows_ssh winboxB winboxC":
|
160
|
+
[
|
161
|
+
"role[base],role[iisserver]",
|
162
|
+
"-x Administrator -P 'super_secret_password'"
|
163
|
+
]
|
144
164
|
}
|
145
165
|
]
|
146
166
|
}
|
@@ -148,7 +168,7 @@ From the `example.json`:
|
|
148
168
|
|
149
169
|
Cookbooks
|
150
170
|
---------
|
151
|
-
The `cookbooks` section of the JSON or YAML file currently supports `knife cookbook upload FOO` where `FOO` is the name of the cookbook in the `cookbooks` directory. The default behavior is to download the cookbook as a tarball, untar it and remove the tarball. The `--siteinstall` option will allow for use of `knife cookbook site install` with the cookbook and the creation of a vendor branch if git is the underlying version control. If a version is passed, it is validated against the existing cookbook `metadata.rb` and it must match the `metadata.rb` string exactly. You may pass any additional arguments if necessary. The YAML snippet
|
171
|
+
The `cookbooks` section of the JSON or YAML file currently supports `knife cookbook upload FOO` where `FOO` is the name of the cookbook in the `cookbooks` directory. The default behavior is to download the cookbook as a tarball, untar it and remove the tarball. The `--siteinstall` option will allow for use of `knife cookbook site install` with the cookbook and the creation of a vendor branch if git is the underlying version control. If a version is passed, it is validated against the existing cookbook `metadata.rb` and it must match the `metadata.rb` string exactly. You may pass any additional arguments if necessary. The example YAML snippet
|
152
172
|
|
153
173
|
``` yaml
|
154
174
|
cookbooks:
|
@@ -171,7 +191,7 @@ knife cookbook upload mysql
|
|
171
191
|
|
172
192
|
Environments
|
173
193
|
------------
|
174
|
-
The `environments` section of the JSON or YAML file currently supports `knife environment from file FOO` where `FOO` is the name of the environment file ending in `.rb` in the `environments` directory. The YAML snippet
|
194
|
+
The `environments` section of the JSON or YAML file currently supports `knife environment from file FOO` where `FOO` is the name of the environment file ending in `.rb` in the `environments` directory. The example YAML snippet
|
175
195
|
|
176
196
|
``` yaml
|
177
197
|
environments:
|
@@ -190,7 +210,7 @@ knife environment from file production.rb
|
|
190
210
|
|
191
211
|
Roles
|
192
212
|
-----
|
193
|
-
The `roles` section of the JSON or YAML file currently supports `knife role from file FOO` where `FOO` is the name of the role file ending in `.rb` in the `roles` directory. The YAML snippet
|
213
|
+
The `roles` section of the JSON or YAML file currently supports `knife role from file FOO` where `FOO` is the name of the role file ending in `.rb` in the `roles` directory. The example YAML snippet
|
194
214
|
|
195
215
|
``` yaml
|
196
216
|
roles:
|
@@ -242,7 +262,7 @@ knife data bag from file passwords data_bags/passwords/rabbitmq.json --secret-fi
|
|
242
262
|
|
243
263
|
Nodes
|
244
264
|
-----
|
245
|
-
The `nodes` section of the JSON or YAML file bootstraps a node for each entry where the entry is a hostname or provider and count. Each node requires 2 items after it in a sequence. The first item is the run_list and the second the CLI options used. The run_list may be space or comma-delimited. Validation is performed on the run_list components to ensure that only recipes and roles listed in the file are used. A shortcut syntax for bulk-creating nodes with various providers where the line starts with the provider and ends with the number of nodes to be provisioned. The YAML snippet
|
265
|
+
The `nodes` section of the JSON or YAML file bootstraps a node for each entry where the entry is a hostname or provider and count. Each node requires 2 items after it in a sequence. The first item is the run_list and the second the CLI options used. The run_list may be space or comma-delimited. Validation is performed on the run_list components to ensure that only recipes and roles listed in the file are used. You may specify multiple nodes to have the same configuration by listing them separated by a space. A shortcut syntax for bulk-creating nodes with various providers where the line starts with the provider and ends with the number of nodes to be provisioned. Windows nodes need to specify either `windows_winrm` or `windows_ssh` depending on the protocol used, followed by the name of the node(s). The example YAML snippet
|
246
266
|
|
247
267
|
``` yaml
|
248
268
|
nodes:
|
@@ -258,6 +278,12 @@ nodes:
|
|
258
278
|
- rackspace 3:
|
259
279
|
- recipe[mysql],role[monitoring]
|
260
280
|
- --image 49 --flavor 2
|
281
|
+
- windows_winrm winboxA:
|
282
|
+
- role[base],role[iisserver]
|
283
|
+
- -x Administrator -P 'super_secret_password'
|
284
|
+
- windows_ssh winboxB winboxC:
|
285
|
+
- role[base],role[iisserver]
|
286
|
+
- -x Administrator -P 'super_secret_password'
|
261
287
|
```
|
262
288
|
|
263
289
|
produces the knife commands
|
@@ -272,6 +298,9 @@ knife ec2 server create 'role[webserver],recipe[mysql::client]' -S mray -i ~/.ss
|
|
272
298
|
knife rackspace server create 'recipe[mysql],role[monitoring]' --image 49 --flavor 2
|
273
299
|
knife rackspace server create 'recipe[mysql],role[monitoring]' --image 49 --flavor 2
|
274
300
|
knife rackspace server create 'recipe[mysql],role[monitoring]' --image 49 --flavor 2
|
301
|
+
knife bootstrap windows winrm winboxA -x Administrator -P 'super_secret_password' -r 'role[base],role[iisserver]'
|
302
|
+
knife bootstrap windows ssh winboxB -x Administrator -P 'super_secret_password' -r 'role[base],role[iisserver]'
|
303
|
+
knife bootstrap windows ssh winboxC -x Administrator -P 'super_secret_password' -r 'role[base],role[iisserver]'
|
275
304
|
```
|
276
305
|
|
277
306
|
Usage
|
@@ -31,6 +31,17 @@ class Spiceweasel::NodeList
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
@delete += "knife node#{options['knife_options']} list | xargs knife #{provider[0]} server delete -y\n"
|
34
|
+
elsif node.keys[0].start_with?("windows") #windows node bootstrap support
|
35
|
+
nodeline = node.keys[0].split()
|
36
|
+
provider = nodeline.shift.split('_') #split on 'windows_ssh' etc
|
37
|
+
nodeline.each do |server|
|
38
|
+
@create += "knife bootstrap #{provider[0]} #{provider[1]}#{options['knife_options']} #{server} #{node[node.keys[0]][1]}"
|
39
|
+
if run_list.length > 0
|
40
|
+
@create += " -r '#{node[node.keys[0]][0].gsub(/ /,',')}'\n"
|
41
|
+
end
|
42
|
+
@delete += "knife node#{options['knife_options']} delete #{server} -y\n"
|
43
|
+
end
|
44
|
+
@delete += "knife node#{options['knife_options']} list | xargs knife #{provider[0]} server delete -y\n"
|
34
45
|
else #node bootstrap support
|
35
46
|
node.keys[0].split.each do |server|
|
36
47
|
@create += "knife bootstrap#{options['knife_options']} #{server} #{node[node.keys[0]][1]}"
|
@@ -0,0 +1,40 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Matt Ray (<matt@opscode.com>)
|
3
|
+
#
|
4
|
+
# Copyright:: 2011, Opscode, Inc <legal@opscode.com>
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
#find a list of all the recipes provided by the included cookbooks for validation
|
20
|
+
class Spiceweasel::RecipeList
|
21
|
+
def initialize(cookbooks = [], options = {})
|
22
|
+
@recipes = []
|
23
|
+
if NOVALIDATION
|
24
|
+
STDOUT.puts "DEBUG: Skipping validation of recipes" if DEBUG
|
25
|
+
else
|
26
|
+
if cookbooks
|
27
|
+
cookbooks.each do |cookbook|
|
28
|
+
#check contents of each cookbook and pull out the recipes
|
29
|
+
#store in recipes in the form cookbook::recipe
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
attr_reader :recipes, :create, :delete
|
36
|
+
|
37
|
+
def member?(recipe)
|
38
|
+
recipes.include?(recipe)
|
39
|
+
end
|
40
|
+
end
|
data/lib/spiceweasel/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spiceweasel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,12 +10,12 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-12-14 00:00:00.000000000 -06:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: chef
|
18
|
-
requirement: &
|
18
|
+
requirement: &2164297640 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ! '>='
|
@@ -23,10 +23,10 @@ dependencies:
|
|
23
23
|
version: '0'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *2164297640
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: json
|
29
|
-
requirement: &
|
29
|
+
requirement: &2164297040 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
32
|
- - ! '>='
|
@@ -34,10 +34,10 @@ dependencies:
|
|
34
34
|
version: '0'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
|
-
version_requirements: *
|
37
|
+
version_requirements: *2164297040
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: mixlib-cli
|
40
|
-
requirement: &
|
40
|
+
requirement: &2164296500 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
43
|
- - ! '>='
|
@@ -45,10 +45,10 @@ dependencies:
|
|
45
45
|
version: '0'
|
46
46
|
type: :runtime
|
47
47
|
prerelease: false
|
48
|
-
version_requirements: *
|
48
|
+
version_requirements: *2164296500
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: rspec
|
51
|
-
requirement: &
|
51
|
+
requirement: &2164295960 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
53
53
|
requirements:
|
54
54
|
- - ! '>='
|
@@ -56,7 +56,7 @@ dependencies:
|
|
56
56
|
version: '0'
|
57
57
|
type: :development
|
58
58
|
prerelease: false
|
59
|
-
version_requirements: *
|
59
|
+
version_requirements: *2164295960
|
60
60
|
description: This provides a CLI for generating knife commands to build Chef-managed
|
61
61
|
infrastructure from a simple YAML file.
|
62
62
|
email:
|
@@ -73,6 +73,7 @@ files:
|
|
73
73
|
- lib/spiceweasel/data_bag_list.rb
|
74
74
|
- lib/spiceweasel/environment_list.rb
|
75
75
|
- lib/spiceweasel/node_list.rb
|
76
|
+
- lib/spiceweasel/recipe_list.rb
|
76
77
|
- lib/spiceweasel/role_list.rb
|
77
78
|
- lib/spiceweasel/run_list.rb
|
78
79
|
- lib/spiceweasel/version.rb
|