elevage 0.1.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.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +21 -0
- data/.rubocop.yml +8 -0
- data/.ruby-version +1 -0
- data/.simplecov +8 -0
- data/.travis.yml +3 -0
- data/.yardoc/checksums +12 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/Gemfile +4 -0
- data/Guardfile +10 -0
- data/LICENSE.txt +203 -0
- data/README.md +112 -0
- data/Rakefile +20 -0
- data/bin/elevage +4 -0
- data/coverage/.resultset.json.lock +0 -0
- data/doc/Elevage/Build.html +435 -0
- data/doc/Elevage/CLI.html +282 -0
- data/doc/Elevage/Environment.html +950 -0
- data/doc/Elevage/Generate.html +346 -0
- data/doc/Elevage/Health.html +359 -0
- data/doc/Elevage/New.html +411 -0
- data/doc/Elevage/Platform.html +1119 -0
- data/doc/Elevage/Provisioner.html +804 -0
- data/doc/Elevage/ProvisionerRunQueue.html +765 -0
- data/doc/Elevage/Runner.html +319 -0
- data/doc/Elevage.html +501 -0
- data/doc/_index.html +239 -0
- data/doc/class_list.html +58 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +339 -0
- data/doc/file.README.html +187 -0
- data/doc/file_list.html +60 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +187 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +181 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +369 -0
- data/doc/top-level-namespace.html +112 -0
- data/elevage.gemspec +39 -0
- data/features/archive +314 -0
- data/features/build.feature +237 -0
- data/features/elevage.feature +24 -0
- data/features/generate.feature +235 -0
- data/features/health_env_failure.feature +292 -0
- data/features/health_failure.feature +291 -0
- data/features/health_success.feature +279 -0
- data/features/list.feature +315 -0
- data/features/new.feature +68 -0
- data/features/step_definitions/elevage_steps.rb +27 -0
- data/features/support/env.rb +9 -0
- data/lib/elevage/build.rb +109 -0
- data/lib/elevage/constants.rb +113 -0
- data/lib/elevage/environment.rb +223 -0
- data/lib/elevage/generate.rb +48 -0
- data/lib/elevage/health.rb +27 -0
- data/lib/elevage/new.rb +30 -0
- data/lib/elevage/platform.rb +105 -0
- data/lib/elevage/provisioner.rb +169 -0
- data/lib/elevage/provisionerrunqueue.rb +114 -0
- data/lib/elevage/runner.rb +39 -0
- data/lib/elevage/templates/compute.yml.tt +18 -0
- data/lib/elevage/templates/environment.yml.tt +20 -0
- data/lib/elevage/templates/network.yml.tt +16 -0
- data/lib/elevage/templates/platform.yml.tt +110 -0
- data/lib/elevage/templates/vcenter.yml.tt +77 -0
- data/lib/elevage/version.rb +4 -0
- data/lib/elevage.rb +45 -0
- data/spec/spec_helper.rb +4 -0
- metadata +357 -0
@@ -0,0 +1,315 @@
|
|
1
|
+
Feature: LIST platform definition file items
|
2
|
+
|
3
|
+
As an Infracoder developing a command line tool
|
4
|
+
I want to display vcenters, networks, components, and other desired elements in the platform files
|
5
|
+
In order to maintain the health of the elevage platform definition files
|
6
|
+
|
7
|
+
Scenario: list desired state items for platform and environment definitions
|
8
|
+
|
9
|
+
Given a file named "platform.yml" with:
|
10
|
+
"""
|
11
|
+
platform:
|
12
|
+
name: app
|
13
|
+
description: 'description of the app'
|
14
|
+
|
15
|
+
environments:
|
16
|
+
- int
|
17
|
+
- prod
|
18
|
+
|
19
|
+
tiers:
|
20
|
+
- Web
|
21
|
+
- App
|
22
|
+
|
23
|
+
nodenameconvention:
|
24
|
+
- environment
|
25
|
+
- '-'
|
26
|
+
- component
|
27
|
+
- '-'
|
28
|
+
- instance
|
29
|
+
- geo
|
30
|
+
|
31
|
+
pools:
|
32
|
+
webvmdefaults: &webvmdefaults
|
33
|
+
count: 2
|
34
|
+
tier: Web
|
35
|
+
image: 'centos-6.5-x86_64-20140714'
|
36
|
+
compute: nonprodweb
|
37
|
+
port: 80
|
38
|
+
runlist:
|
39
|
+
- 'role[loc_uswest]'
|
40
|
+
- 'role[base]'
|
41
|
+
componentrole: 'role[#]'
|
42
|
+
|
43
|
+
appvmdefaults: &appvmdefaults
|
44
|
+
<<: *webvmdefaults
|
45
|
+
tier: App
|
46
|
+
compute: nonprodapp
|
47
|
+
|
48
|
+
components:
|
49
|
+
api:
|
50
|
+
<<: *webvmdefaults
|
51
|
+
port: 8080
|
52
|
+
|
53
|
+
cui:
|
54
|
+
<<: *webvmdefaults
|
55
|
+
port: 8082
|
56
|
+
|
57
|
+
terracotta:
|
58
|
+
<<: *webvmdefaults
|
59
|
+
compute: nonprodtc
|
60
|
+
image: 'centos32g-6.5-x86_64-20140714'
|
61
|
+
|
62
|
+
email:
|
63
|
+
<<: *appvmdefaults
|
64
|
+
port: 8130
|
65
|
+
|
66
|
+
mq:
|
67
|
+
<<: *appvmdefaults
|
68
|
+
port: 1234
|
69
|
+
compute: nonprodmq
|
70
|
+
image: 'centos32g-6.5-x86_64-20140714'
|
71
|
+
"""
|
72
|
+
Given a file named "infrastructure/vcenter.yml" with:
|
73
|
+
"""
|
74
|
+
vcenter:
|
75
|
+
nonprod: &vcenter
|
76
|
+
geo: west
|
77
|
+
timezone: 085
|
78
|
+
|
79
|
+
host: 'www.google.com'
|
80
|
+
datacenter: 'WCDC NonProd'
|
81
|
+
imagefolder: 'Corporate/Platform Services/Templates'
|
82
|
+
destfolder: 'Corporate/Platform Services/app'
|
83
|
+
resourcepool: 'App-Web Linux/Corporate'
|
84
|
+
appendenv: true
|
85
|
+
appenddomain: true
|
86
|
+
datastores:
|
87
|
+
- NonProd_Cor_25
|
88
|
+
- NonProd_Cor_26
|
89
|
+
- NonProd_Cor_38
|
90
|
+
- NonProd_Cor_39
|
91
|
+
|
92
|
+
domain: dev.corp.local
|
93
|
+
dnsips:
|
94
|
+
- 10.10.10.5
|
95
|
+
- 10.10.10.6
|
96
|
+
|
97
|
+
prod:
|
98
|
+
<<: *vcenter
|
99
|
+
|
100
|
+
datacenter: 'WCDC Prod'
|
101
|
+
datastores:
|
102
|
+
- Prod_Cor_03
|
103
|
+
- Prod_Cor_04
|
104
|
+
|
105
|
+
domain: corp.local
|
106
|
+
dnsips:
|
107
|
+
- 10.20.100.5
|
108
|
+
- 10.20.100.6
|
109
|
+
"""
|
110
|
+
Given a file named "infrastructure/network.yml" with:
|
111
|
+
"""
|
112
|
+
network:
|
113
|
+
devweb:
|
114
|
+
vlanid: DEV_WEB_NET
|
115
|
+
gateway: '10.10.128.1'
|
116
|
+
netmask: 19
|
117
|
+
|
118
|
+
devapp:
|
119
|
+
vlanid: DEV_APP_NET
|
120
|
+
gateway: '10.10.160.1'
|
121
|
+
netmask: 20
|
122
|
+
|
123
|
+
prodweb:
|
124
|
+
vlanid: PRD_WEB_NET
|
125
|
+
gateway: '10.119.128.1'
|
126
|
+
netmask: 19
|
127
|
+
|
128
|
+
prodapp:
|
129
|
+
vlanid: PRD_APP_NET
|
130
|
+
gateway: '10.119.160.1'
|
131
|
+
netmask: 20
|
132
|
+
"""
|
133
|
+
Given a file named "infrastructure/compute.yml" with:
|
134
|
+
"""
|
135
|
+
compute:
|
136
|
+
default: &default
|
137
|
+
cpu: 2
|
138
|
+
ram: 2
|
139
|
+
|
140
|
+
nonprodweb:
|
141
|
+
<<: *default
|
142
|
+
|
143
|
+
nonprodapp:
|
144
|
+
<<: *default
|
145
|
+
ram: 6
|
146
|
+
|
147
|
+
nonprodtc:
|
148
|
+
<<: *default
|
149
|
+
ram: 8
|
150
|
+
|
151
|
+
nonprodmq:
|
152
|
+
<<: *default
|
153
|
+
ram: 12
|
154
|
+
|
155
|
+
prodweb:
|
156
|
+
<<: *default
|
157
|
+
ram: 6
|
158
|
+
|
159
|
+
prodapp:
|
160
|
+
<<: *default
|
161
|
+
ram: 6
|
162
|
+
|
163
|
+
prodtc:
|
164
|
+
<<: *default
|
165
|
+
ram: 32
|
166
|
+
|
167
|
+
prodmq:
|
168
|
+
<<: *default
|
169
|
+
cpu: 8
|
170
|
+
ram: 32
|
171
|
+
"""
|
172
|
+
Given a file named "environments/int.yml" with:
|
173
|
+
"""
|
174
|
+
environment:
|
175
|
+
vcenter: nonprod
|
176
|
+
|
177
|
+
pool:
|
178
|
+
webvmdefaults: &webvmdefaults
|
179
|
+
network: devweb
|
180
|
+
compute: nonprodweb
|
181
|
+
|
182
|
+
appvmdefaults: &appvmdefaults
|
183
|
+
<<: *webvmdefaults
|
184
|
+
network: devapp
|
185
|
+
compute: nonprodapp
|
186
|
+
|
187
|
+
components:
|
188
|
+
api:
|
189
|
+
addresses:
|
190
|
+
- 10.10.137.42
|
191
|
+
- 10.10.137.43
|
192
|
+
|
193
|
+
cui:
|
194
|
+
addresses:
|
195
|
+
- 10.10.137.64
|
196
|
+
- 10.10.137.65
|
197
|
+
|
198
|
+
terracotta:
|
199
|
+
addresses:
|
200
|
+
- 10.10.137.95
|
201
|
+
- 10.10.137.96
|
202
|
+
|
203
|
+
email:
|
204
|
+
addresses:
|
205
|
+
- 10.10.161.53
|
206
|
+
- 10.10.161.54
|
207
|
+
|
208
|
+
mq:
|
209
|
+
addresses:
|
210
|
+
- 10.10.161.77
|
211
|
+
- 10.10.161.78
|
212
|
+
"""
|
213
|
+
Given a file named "environments/prod.yml" with:
|
214
|
+
"""
|
215
|
+
environment:
|
216
|
+
vcenter: prod
|
217
|
+
|
218
|
+
pool:
|
219
|
+
webvmdefaults: &webvmdefaults
|
220
|
+
network: prodweb
|
221
|
+
count: 4
|
222
|
+
compute: prodweb
|
223
|
+
|
224
|
+
appvmdefaults: &appvmdefaults
|
225
|
+
<<: *webvmdefaults
|
226
|
+
network: prodapp
|
227
|
+
compute: prodapp
|
228
|
+
|
229
|
+
|
230
|
+
components:
|
231
|
+
api:
|
232
|
+
addresses:
|
233
|
+
- 10.119.137.72
|
234
|
+
- 10.119.137.73
|
235
|
+
- 10.119.137.74
|
236
|
+
- 10.119.137.75
|
237
|
+
|
238
|
+
cui:
|
239
|
+
addresses:
|
240
|
+
- 10.119.137.133
|
241
|
+
- 10.119.137.134
|
242
|
+
- 10.119.137.135
|
243
|
+
- 10.119.137.136
|
244
|
+
|
245
|
+
terracotta:
|
246
|
+
count: 2
|
247
|
+
compute: prodtc
|
248
|
+
addresses:
|
249
|
+
- 10.119.137.218
|
250
|
+
- 10.119.137.219
|
251
|
+
port: 0000
|
252
|
+
|
253
|
+
email:
|
254
|
+
addresses:
|
255
|
+
- 10.119.161.137
|
256
|
+
- 10.119.161.138
|
257
|
+
- 10.119.161.139
|
258
|
+
- 10.119.161.140
|
259
|
+
|
260
|
+
mq:
|
261
|
+
count: 2
|
262
|
+
compute: prodmq
|
263
|
+
addresses:
|
264
|
+
- 10.119.161.206
|
265
|
+
- 10.119.161.207
|
266
|
+
"""
|
267
|
+
|
268
|
+
When I run `elevage list environments`
|
269
|
+
Then the exit status should be 0
|
270
|
+
And the output should contain "- int\n- prod"
|
271
|
+
|
272
|
+
When I run `elevage list tiers`
|
273
|
+
Then the exit status should be 0
|
274
|
+
And the output should contain "- Web\n- App"
|
275
|
+
|
276
|
+
When I run `elevage list pools`
|
277
|
+
Then the exit status should be 0
|
278
|
+
And the output should contain "appvmdefaults:\n count: 2\n tier: App\n image: centos-6.5-x86_64-20140714\n compute: nonprodapp\n port: 80"
|
279
|
+
|
280
|
+
When I run `elevage list components`
|
281
|
+
Then the exit status should be 0
|
282
|
+
And the output should contain "terracotta:\n count: 2\n tier: Web\n image: centos32g-6.5-x86_64-20140714\n compute: nonprodtc\n port: 80"
|
283
|
+
|
284
|
+
When I run `elevage list vcenter`
|
285
|
+
Then the exit status should be 0
|
286
|
+
And the output should contain "prod:\n geo: west\n timezone: 085\n host: www.google.com\n datacenter: WCDC Prod"
|
287
|
+
|
288
|
+
When I run `elevage list compute`
|
289
|
+
Then the exit status should be 0
|
290
|
+
And the output should contain "prodtc:\n cpu: 2\n ram: 32"
|
291
|
+
|
292
|
+
When I run `elevage list network`
|
293
|
+
Then the exit status should be 0
|
294
|
+
And the output should contain "prodweb:\n vlanid: PRD_WEB_NET"
|
295
|
+
|
296
|
+
When I run `elevage list prod`
|
297
|
+
Then the exit status should be 0
|
298
|
+
And the output should contain "vlanid: PRD_WEB_NET"
|
299
|
+
And the output should contain "cpu: 2"
|
300
|
+
And the output should contain "datacenter: WCDC Prod"
|
301
|
+
And the output should contain "runlist: role[loc_uswest],role[base],role[api]"
|
302
|
+
|
303
|
+
When I run `elevage list prod -n`
|
304
|
+
Then the exit status should be 0
|
305
|
+
And the output should contain "10.119.161.137"
|
306
|
+
And the output should contain "prod-email-01w.app.corp.local"
|
307
|
+
|
308
|
+
When I run `elevage list int -n`
|
309
|
+
Then the exit status should be 0
|
310
|
+
And the output should contain "10.10.161.53"
|
311
|
+
And the output should contain "int-email-01w.app.dev.corp.local"
|
312
|
+
|
313
|
+
When I run `elevage list random`
|
314
|
+
Then the exit status should be 1
|
315
|
+
And the output should contain "unknown LIST command"
|
@@ -0,0 +1,68 @@
|
|
1
|
+
Feature: creating NEW platform definition files
|
2
|
+
|
3
|
+
As an Infracoder developing a command line tool
|
4
|
+
I want to test the accuracy of the files and folders created by the NEW command
|
5
|
+
In order to maintain the health of the elevage generator commands
|
6
|
+
|
7
|
+
Scenario: generating new platform
|
8
|
+
|
9
|
+
When I run `elevage new app`
|
10
|
+
Then the following files should exist:
|
11
|
+
|platform.yml|
|
12
|
+
|infrastructure/vcenter.yml|
|
13
|
+
|infrastructure/compute.yml|
|
14
|
+
|infrastructure/network.yml|
|
15
|
+
And the file "platform.yml" should contain:
|
16
|
+
"""
|
17
|
+
platform:
|
18
|
+
name: app
|
19
|
+
"""
|
20
|
+
And the file "infrastructure/vcenter.yml" should contain:
|
21
|
+
"""
|
22
|
+
vcenter:
|
23
|
+
"""
|
24
|
+
And the file "infrastructure/network.yml" should contain:
|
25
|
+
"""
|
26
|
+
network:
|
27
|
+
"""
|
28
|
+
And the file "infrastructure/compute.yml" should contain:
|
29
|
+
"""
|
30
|
+
compute:
|
31
|
+
"""
|
32
|
+
|
33
|
+
Scenario: generating new platform called when platform already exists
|
34
|
+
|
35
|
+
Given a file named "platform.yml" with:
|
36
|
+
"""
|
37
|
+
platform:
|
38
|
+
name: app
|
39
|
+
"""
|
40
|
+
When I run `elevage new app`
|
41
|
+
Then the exit status should be 1
|
42
|
+
And the output should contain "elevage: platform files already exist!"
|
43
|
+
|
44
|
+
# Scenario: generating new platform with -chef option
|
45
|
+
#
|
46
|
+
# When I run `elevage new app -chef`
|
47
|
+
# Then the following files should exist:
|
48
|
+
# |app_definition/platform.yml|
|
49
|
+
# |app_definition/infrastructure/vcenter.yml|
|
50
|
+
# |app_definition/infrastructure/compute.yml|
|
51
|
+
# |app_definition/infrastructure/network.yml|
|
52
|
+
# And the file "app_definition/platform.yml" should contain:
|
53
|
+
# """
|
54
|
+
# platform:
|
55
|
+
# name: app
|
56
|
+
# """
|
57
|
+
# And the file "app_definition/infrastructure/vcenter.yml" should contain:
|
58
|
+
# """
|
59
|
+
# vcenter:
|
60
|
+
# """
|
61
|
+
# And the file "app_definition/infrastructure/network.yml" should contain:
|
62
|
+
# """
|
63
|
+
# network:
|
64
|
+
# """
|
65
|
+
# And the file "app_definition/infrastructure/compute.yml" should contain:
|
66
|
+
# """
|
67
|
+
# compute:
|
68
|
+
# """
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# rubocop:disable LineLength, StringLiterals
|
2
|
+
When(/^I get general help for "([^"]*)"$/) do |app_name|
|
3
|
+
@app_name = app_name
|
4
|
+
step %(I run `#{app_name} --help`)
|
5
|
+
step %(I run `#{app_name}`)
|
6
|
+
end
|
7
|
+
|
8
|
+
Then(/^the banner should be present$/) do
|
9
|
+
step %(the output should match /elevage commands:/)
|
10
|
+
end
|
11
|
+
|
12
|
+
Then(/^the following commands should be documented:$/) do |options|
|
13
|
+
options.raw.each do |option|
|
14
|
+
step %(the command "#{option[0]}" should be documented)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
Then(/^the command "([^"]*)" should be documented$/) do |options|
|
19
|
+
options.split(',').map(&:strip).each do |option|
|
20
|
+
step %(the output should match /\\s*#{Regexp.escape(option)}[\\s\\W]+\\w[\\s\\w][\\s\\w]+/)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
Then(/^the output should display the version$/) do
|
25
|
+
step %(the output should match /\\d+\\.\\d+\\.\\d+/)
|
26
|
+
end
|
27
|
+
# rubocop:enable LineLength, StringLiterals
|
@@ -0,0 +1,109 @@
|
|
1
|
+
require 'thor/group'
|
2
|
+
|
3
|
+
module Elevage
|
4
|
+
# Create new platform definition files and environments folder structure
|
5
|
+
class Build < Thor::Group
|
6
|
+
include Thor::Actions
|
7
|
+
|
8
|
+
# Build subcommand arguments and options
|
9
|
+
# rubocop:disable LineLength
|
10
|
+
argument :env, type: :string, desc: DESC_BUILD
|
11
|
+
class_option :all, type: :boolean, aliases: '-a', desc: DESC_BUILD_ALL
|
12
|
+
class_option :tier, type: :string, aliases: '-t', desc: DESC_BUILD_TIER
|
13
|
+
class_option :component, type: :string, aliases: '-c', desc: DESC_BUILD_COMPONENT
|
14
|
+
class_option :node, type: :numeric, aliases: '-n', desc: DESC_BUILD_NODE
|
15
|
+
class_option :concurrency, type: :numeric, aliases: '-C', default: 8, desc: DESC_BUILD_CONCURRENCY
|
16
|
+
class_option :logfiles, type: :string, aliases: '-l', default: 'logs', desc: DESC_BUILD_LOGFILES
|
17
|
+
class_option :verbose, type: :boolean, aliases: '-v', default: false
|
18
|
+
# rubocop:enable LineLength
|
19
|
+
|
20
|
+
# dry-run
|
21
|
+
class_option 'dry-run', type: :boolean, desc: DESC_BUILD_DRY_RUN
|
22
|
+
|
23
|
+
# Additional options for passing to the knife command
|
24
|
+
# rubocop:disable LineLength
|
25
|
+
class_option 'vsuser', default: 'svc_provisioner', type: :string, desc: DESC_BUILD_VSUSER
|
26
|
+
class_option 'vspass', default: 'changeme', type: :string, desc: DESC_BUILD_VSPASS
|
27
|
+
class_option 'ssh-user', default: 'knife', type: :string, aliases: '-x', desc: DESC_BUILD_SSH_USER
|
28
|
+
class_option 'ssh-key', default: 'knife_rsa', type: :string, aliases: '-i', desc: DESC_BUILD_SSH_KEY
|
29
|
+
class_option 'template-file', default: 'chef-full.erb', type: :string, aliases: '-t', desc: DESC_BUILD_TEMPLATE_FILE
|
30
|
+
class_option 'bootstrap-version', default: '11.4.0', type: :string, aliases: '-b', desc: DESC_BUILD_BOOTSTRAP_VERSION
|
31
|
+
# rubocop:enable LineLength
|
32
|
+
|
33
|
+
def self.source_root
|
34
|
+
File.dirname(__FILE__)
|
35
|
+
end
|
36
|
+
|
37
|
+
# rubocop:disable MethodLength, LineLength, CyclomaticComplexity, PerceivedComplexity
|
38
|
+
def build
|
39
|
+
# Make the logfile directory if it doesn't exist
|
40
|
+
Dir.mkdir(options[:logfiles]) unless Dir.exist?(options[:logfiles])
|
41
|
+
|
42
|
+
# Fetch the environment and make sure it passes basic health checks
|
43
|
+
@environment = Elevage::Environment.new(env)
|
44
|
+
fail(IOError) unless @environment.healthy?
|
45
|
+
|
46
|
+
# =============================================================
|
47
|
+
# Option sanity checking.
|
48
|
+
#
|
49
|
+
# What are we going to reject as invalid options?
|
50
|
+
#
|
51
|
+
if options[:all] && options[:tier] || options[:all] && options[:component] || options[:tier] && options[:component]
|
52
|
+
warn 'The --all, --tier and --component options may not be specified together.'
|
53
|
+
exit false
|
54
|
+
end
|
55
|
+
|
56
|
+
if options[:node] && !options[:component]
|
57
|
+
warn 'When requesting a --node you must specify which --component.'
|
58
|
+
exit false
|
59
|
+
end
|
60
|
+
|
61
|
+
unless options[:all] || options[:tier] || options[:component]
|
62
|
+
warn 'You must specify one of --all, --tier=<tier>, or --component=<component>'
|
63
|
+
exit false
|
64
|
+
end
|
65
|
+
|
66
|
+
# Determine what, exactly, we're supposed to build
|
67
|
+
if options[:all]
|
68
|
+
# =============================================================
|
69
|
+
# Build ALL THE THINGS!
|
70
|
+
#
|
71
|
+
@environment.provision(type: :all,
|
72
|
+
options: options)
|
73
|
+
|
74
|
+
elsif options[:tier]
|
75
|
+
# =============================================================
|
76
|
+
# Build most of the things...
|
77
|
+
#
|
78
|
+
if options[:tier].eql?('tier')
|
79
|
+
warn 'Was asked to build a tier, but was not told which one!'
|
80
|
+
exit false
|
81
|
+
end
|
82
|
+
@environment.provision(type: :tier,
|
83
|
+
tier: options[:tier],
|
84
|
+
options: options)
|
85
|
+
|
86
|
+
elsif options[:component]
|
87
|
+
# =============================================================
|
88
|
+
# Build a few things...
|
89
|
+
#
|
90
|
+
if options[:component].eql?('component')
|
91
|
+
warn 'Was asked to build a component, but was not told which one!'
|
92
|
+
exit false
|
93
|
+
end
|
94
|
+
# See if we're actually only supposed to build just one thing...
|
95
|
+
if options[:node]
|
96
|
+
@environment.provision(type: :node,
|
97
|
+
component: options[:component],
|
98
|
+
instance: options[:node],
|
99
|
+
options: options)
|
100
|
+
else
|
101
|
+
@environment.provision(type: :component,
|
102
|
+
component: options[:component],
|
103
|
+
options: options)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
# rubocop:enable MethodLength, LineLength, CyclomaticComplexity, PerceivedComplexity
|
108
|
+
end
|
109
|
+
end
|
@@ -0,0 +1,113 @@
|
|
1
|
+
# rubocop:disable LineLength, StringLiterals
|
2
|
+
module Elevage
|
3
|
+
# options description messages
|
4
|
+
# DESC_followed by command and the description
|
5
|
+
DESC_VERSION = 'Display installed elevage gem version (Can also use -v)'
|
6
|
+
DESC_NEW = 'Prepare new platform files and folder structure at current location'
|
7
|
+
DESC_LIST = 'List ITEMs from platform desired state yml files'
|
8
|
+
DESC_LIST_NODES = 'used with environment name to list node names and ip addresses'
|
9
|
+
DESC_HEALTH = 'Health check of the Platform desired state yml files'
|
10
|
+
DESC_GENERATE = 'Generate new environment file based on platform template'
|
11
|
+
DESC_BUILD = 'Provision vms in an environment definition'
|
12
|
+
DESC_BUILD_DRY_RUN = 'Do not actually do anything, just display the commands that would be run.'
|
13
|
+
DESC_BUILD_ENV = 'Name of the platform environment to provision'
|
14
|
+
DESC_BUILD_USER = 'User name for vSphere'
|
15
|
+
DESC_BUILD_PASSWD = 'Password for vSphere'
|
16
|
+
DESC_BUILD_ALL = 'Build everything for the named environment'
|
17
|
+
DESC_BUILD_TIER = 'Build everything for the specified tier in the named environment'
|
18
|
+
DESC_BUILD_COMPONENT = 'Build all nodes for the specified component'
|
19
|
+
DESC_BUILD_NODE = 'Build the single specified node'
|
20
|
+
DESC_BUILD_VSUSER = 'Username for vSphere'
|
21
|
+
DESC_BUILD_VSPASS = 'Password for vSphere'
|
22
|
+
DESC_BUILD_SSH_USER = 'Unix username for ssh for chef-client bootstrap (must have sudo NOPASSWD access for root)'
|
23
|
+
DESC_BUILD_SSH_KEY = 'Path to SSH private key for ssh username for key-based authentication'
|
24
|
+
DESC_BUILD_TEMPLATE_FILE = 'File to be used as the chef-client bootstrap template script'
|
25
|
+
DESC_BUILD_BOOTSTRAP_VERSION = 'Version of chef-client to bootstrap on node'
|
26
|
+
DESC_BUILD_CONCURRENCY = 'Maximum number of simultaneous provisioning tasks'
|
27
|
+
DESC_BUILD_LOGFILES = 'Path where log files should be written'
|
28
|
+
|
29
|
+
# available List commands
|
30
|
+
LIST_CMDS = %w(environments tiers pools components network vcenter compute)
|
31
|
+
|
32
|
+
# Health check range settings
|
33
|
+
TIMEZONE_LIMIT = 159
|
34
|
+
CPU_LIMIT = 16
|
35
|
+
RAM_LIMIT = 128
|
36
|
+
POOL_LIMIT = 256
|
37
|
+
|
38
|
+
# Health check messages
|
39
|
+
MSG_HEALTHY = 'All base platform desired state files created and syntactically correct'
|
40
|
+
MSG_ENV_HEALTHY = ' specific definition yml syntactically correct'
|
41
|
+
MSG = {
|
42
|
+
empty_environments: "Empty environment definitions\n",
|
43
|
+
empty_tiers: "Empty tier definitions\n",
|
44
|
+
empty_nodenameconvention: "Empty nodenameconvention definitions\n",
|
45
|
+
pool_count_size: "Must define 1 or more nodes in a pool\n",
|
46
|
+
invalid_tiers: "Pool contains invalid tier reference\n",
|
47
|
+
no_image_ref: "No vm image referenced in pool definition\n",
|
48
|
+
invalid_compute: "Pool contains invalid compute reference\n",
|
49
|
+
invalid_port: "Pool contains invalid port definition\n",
|
50
|
+
invalid_runlist: "No pool runlist definition\n",
|
51
|
+
invalid_componentrole: "Pool Componentrole missing #\n",
|
52
|
+
invalid_geo: "no vCenter geo defined\n",
|
53
|
+
invalid_timezone: "Invalid vCenter timezone\n",
|
54
|
+
invalid_host: "vCenter host not accessible\n",
|
55
|
+
invalid_datacenter: "No datacenter defined for vCenter\n",
|
56
|
+
invalid_imagefolder: "No image location defined for vCenter build\n",
|
57
|
+
invalid_destfolder: "No destination folder defined for vCenter build\n",
|
58
|
+
invalid_appendenv: "Append environment to destination folder must be true or false\n",
|
59
|
+
invalid_appenddomain: "prepend app name to domain must be true or false\n",
|
60
|
+
empty_datastores: "No data stores defined for vCenter build\n",
|
61
|
+
invalid_domain: "No domain defined for node fqdn\n",
|
62
|
+
invalid_ip: "Invalid IP's defined for DNS lookup\n",
|
63
|
+
empty_network: "Empty Network defintions\n",
|
64
|
+
invalid_gateway: "Invalid gateway defined in network\n",
|
65
|
+
invalid_cpu: "Invalid compute cpu settings\n",
|
66
|
+
invalid_ram: "Invalid compute ram settings\n",
|
67
|
+
invalid_env_vcenter: "Environment contains invalid vcenter definition\n",
|
68
|
+
invalid_env_network: "Environment contains invalid network definition\n",
|
69
|
+
invalid_env_count: "Environment contains invalid number of nodes in pool\n",
|
70
|
+
invalid_env_compute: "Environment component pool contains invalid compute definition\n",
|
71
|
+
invalid_env_ip: "Environment component pool contains invalid or missing ip address definition\n",
|
72
|
+
invalid_env_tier: "Environment component pool contains invalid tier definition\n",
|
73
|
+
invalid_env_image: "Environment component pool contains invalid image definition\n",
|
74
|
+
invalid_env_port: "Environment component pool contains invalid port definition\n",
|
75
|
+
invalid_env_runlist: "Environment component pool contains invalid runlist specification\n",
|
76
|
+
invalid_env_componentrole: "Environment component pool contains invalid componentrole definition\n",
|
77
|
+
env_component_mismatch: "Environment components do not match platform definition\n"
|
78
|
+
}
|
79
|
+
|
80
|
+
# Templates
|
81
|
+
TEMPLATE_PLATFORM = 'templates/platform.yml.tt'
|
82
|
+
TEMPLATE_VCENTER = 'templates/vcenter.yml.tt'
|
83
|
+
TEMPLATE_NETWORK = 'templates/network.yml.tt'
|
84
|
+
TEMPLATE_COMPUTE = 'templates/compute.yml.tt'
|
85
|
+
TEMPLATE_ENV = 'templates/environment.yml.tt'
|
86
|
+
|
87
|
+
# filename defaults
|
88
|
+
YML_PLATFORM = 'platform.yml'
|
89
|
+
YML_VCENTER = 'infrastructure/vcenter.yml'
|
90
|
+
YML_NETWORK = 'infrastructure/network.yml'
|
91
|
+
YML_COMPUTE = 'infrastructure/compute.yml'
|
92
|
+
ENV_FOLDER = 'environments/'
|
93
|
+
|
94
|
+
# Build defaults
|
95
|
+
BUILD_CONCURRENT_DEFAULT = 4
|
96
|
+
BUILD_CHILD_WAIT_TIMEOUT = 0.5
|
97
|
+
BUILD_STATUS_INTERVAL = 60
|
98
|
+
|
99
|
+
# error messages
|
100
|
+
ERR = {
|
101
|
+
platform_exists: 'elevage: platform files already exist!',
|
102
|
+
not_list_cmd: 'elevage: used an unknown LIST command',
|
103
|
+
no_platform_file: 'elevage: platform.yml file not found!',
|
104
|
+
no_vcenter_file: 'elevage: infastructure/vcenter.yml file not found!',
|
105
|
+
no_network_file: 'elevage: infastructure/network.yml file not found!',
|
106
|
+
no_compute_file: 'elevage: infastructure/compute.yml file not found!',
|
107
|
+
env_exists: 'elevage: environment file already exists!',
|
108
|
+
env_not_defined: 'elevage: environment file not defined in platform',
|
109
|
+
no_env_file: 'elevage: Environment file in platform.yml not found',
|
110
|
+
fail_health_check: 'elevage: health check revealed errors'
|
111
|
+
}
|
112
|
+
end
|
113
|
+
# rubocop:enable LineLength, StringLiterals
|