vominator 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +25 -0
  3. data/.rspec +5 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +116 -0
  7. data/Rakefile +12 -0
  8. data/bin/vominate +12 -0
  9. data/circle.yml +5 -0
  10. data/lib/ec2.rb +12 -0
  11. data/lib/ec2/instances.rb +362 -0
  12. data/lib/ec2/security_groups.rb +314 -0
  13. data/lib/ec2/ssm.rb +81 -0
  14. data/lib/vominator/aws.rb +15 -0
  15. data/lib/vominator/constants.rb +53 -0
  16. data/lib/vominator/ec2.rb +308 -0
  17. data/lib/vominator/instances.rb +34 -0
  18. data/lib/vominator/route53.rb +125 -0
  19. data/lib/vominator/security_groups.rb +26 -0
  20. data/lib/vominator/ssm.rb +57 -0
  21. data/lib/vominator/version.rb +3 -0
  22. data/lib/vominator/vominator.rb +74 -0
  23. data/lib/vominator/vpc.rb +82 -0
  24. data/lib/vpc.rb +8 -0
  25. data/lib/vpc/create.rb +188 -0
  26. data/spec/lib/instances_spec.rb +2 -0
  27. data/spec/lib/vominator/aws_spec.rb +6 -0
  28. data/spec/lib/vominator/ec2_spec.rb +783 -0
  29. data/spec/lib/vominator/instances_spec.rb +96 -0
  30. data/spec/lib/vominator/route53_spec.rb +64 -0
  31. data/spec/lib/vominator/ssm_spec.rb +95 -0
  32. data/spec/lib/vominator/vominator_spec.rb +209 -0
  33. data/spec/spec_helper.rb +103 -0
  34. data/spec/support/matchers/exit_with_code.rb +24 -0
  35. data/test/puke/cloud-configs/.gitkeep +0 -0
  36. data/test/puke/cloud-configs/cloud-config-example.erb +63 -0
  37. data/test/puke/config.yaml +16 -0
  38. data/test/puke/products/sample-api/instances.yaml +37 -0
  39. data/test/puke/products/sample-api/security_groups.yaml +19 -0
  40. data/test/vominator.yaml +7 -0
  41. data/vominator.gemspec +34 -0
  42. metadata +259 -0
@@ -0,0 +1,103 @@
1
+ Dir[File.dirname(__FILE__) + '/support/**/*.rb'].each {|file| require_relative file}
2
+
3
+ unless ENV['VOMINATOR_CONFIG']
4
+ ENV['VOMINATOR_CONFIG']="test/vominator.yaml"
5
+ end
6
+
7
+ if ENV['CIRCLE_ARTIFACTS']
8
+ require 'simplecov'
9
+ dir = File.join("..", "..", "..", ENV['CIRCLE_ARTIFACTS'], "coverage")
10
+ SimpleCov.coverage_dir(dir)
11
+ SimpleCov.start
12
+ end
13
+ # This file was generated by the `rspec --init` command. Conventionally, all
14
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
15
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
16
+ # this file to always be loaded, without a need to explicitly require it in any
17
+ # files.
18
+ #
19
+ # Given that it is always loaded, you are encouraged to keep this file as
20
+ # light-weight as possible. Requiring heavyweight dependencies from this file
21
+ # will add to the boot time of your test suite on EVERY test run, even for an
22
+ # individual file that may not need all of that loaded. Instead, consider making
23
+ # a separate helper file that requires the additional dependencies and performs
24
+ # the additional setup, and require it from the spec files that actually need
25
+ # it.
26
+ #
27
+ # The `.rspec` file also contains a few flags that are not defaults but that
28
+ # users commonly want.
29
+ #
30
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
31
+ RSpec.configure do |config|
32
+ # rspec-expectations config goes here. You can use an alternate
33
+ # assertion/expectation library such as wrong or the stdlib/minitest
34
+ # assertions if you prefer.
35
+ config.expect_with :rspec do |expectations|
36
+ # This option will default to `true` in RSpec 4. It makes the `description`
37
+ # and `failure_message` of custom matchers include text for helper methods
38
+ # defined using `chain`, e.g.:
39
+ # be_bigger_than(2).and_smaller_than(4).description
40
+ # # => "be bigger than 2 and smaller than 4"
41
+ # ...rather than:
42
+ # # => "be bigger than 2"
43
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
44
+ end
45
+
46
+ # rspec-mocks config goes here. You can use an alternate test double
47
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
48
+ config.mock_with :rspec do |mocks|
49
+ # Prevents you from mocking or stubbing a method that does not exist on
50
+ # a real object. This is generally recommended, and will default to
51
+ # `true` in RSpec 4.
52
+ mocks.verify_partial_doubles = true
53
+ end
54
+
55
+ # The settings below are suggested to provide a good initial experience
56
+ # with RSpec, but feel free to customize to your heart's content.
57
+ =begin
58
+ # These two settings work together to allow you to limit a spec run
59
+ # to individual examples or groups you care about by tagging them with
60
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
61
+ # get run.
62
+ config.filter_run :focus
63
+ config.run_all_when_everything_filtered = true
64
+
65
+ # Limits the available syntax to the non-monkey patched syntax that is
66
+ # recommended. For more details, see:
67
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
68
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
69
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
70
+ config.disable_monkey_patching!
71
+
72
+ # This setting enables warnings. It's recommended, but in some cases may
73
+ # be too noisy due to issues in dependencies.
74
+ config.warnings = true
75
+
76
+ # Many RSpec users commonly either run the entire suite or an individual
77
+ # file, and it's useful to allow more verbose output when running an
78
+ # individual spec file.
79
+ if config.files_to_run.one?
80
+ # Use the documentation formatter for detailed output,
81
+ # unless a formatter has already been configured
82
+ # (e.g. via a command-line flag).
83
+ config.default_formatter = 'doc'
84
+ end
85
+
86
+ # Print the 10 slowest examples and example groups at the
87
+ # end of the spec run, to help surface which specs are running
88
+ # particularly slow.
89
+ config.profile_examples = 10
90
+
91
+ # Run specs in random order to surface order dependencies. If you find an
92
+ # order dependency and want to debug it, you can fix the order by providing
93
+ # the seed, which is printed after each run.
94
+ # --seed 1234
95
+ config.order = :random
96
+
97
+ # Seed global randomization in this process using the `--seed` CLI option.
98
+ # Setting this allows you to use `--seed` to deterministically reproduce
99
+ # test failures related to randomization by passing the same `--seed` value
100
+ # as the one that triggered the failure.
101
+ Kernel.srand config.seed
102
+ =end
103
+ end
@@ -0,0 +1,24 @@
1
+ RSpec::Matchers.define :exit_with_code do |exp_code|
2
+ def supports_block_expectations?
3
+ true # or some logic
4
+ end
5
+ actual = nil
6
+ match do |block|
7
+ begin
8
+ block.call
9
+ rescue SystemExit => e
10
+ actual = e.status
11
+ end
12
+ actual and actual == exp_code
13
+ end
14
+ failure_message do |block|
15
+ "expected block to call exit(#{exp_code}) but exit" +
16
+ (actual.nil? ? " not called" : "(#{actual}) was called")
17
+ end
18
+ failure_message_when_negated do |block|
19
+ "expected block not to call exit(#{exp_code})"
20
+ end
21
+ description do
22
+ "expect block to call exit(#{exp_code})"
23
+ end
24
+ end
File without changes
@@ -0,0 +1,63 @@
1
+ #cloud-config
2
+
3
+ #Hostname
4
+ hostname: <%= hostname %>
5
+ fqdn: <%= hostname %>.<%= env %>.example.com
6
+
7
+ # reset localhost on boot
8
+ manage_etc_hosts: True
9
+
10
+ #Dont touch /etc/apt/sources.list as we manage this in the base image.
11
+ apt_preserve_sources_list: true
12
+
13
+ #Perform an apt-get update
14
+ apt_update: True
15
+
16
+ #Tell ohai that we are ec2
17
+ write_files:
18
+ - path: /etc/chef/ohai/hints/ec2.json
19
+ permissions: '0644'
20
+ content: ''
21
+
22
+ chef:
23
+
24
+ # Valid values are 'gems' and 'packages'
25
+ install_type: "packages"
26
+
27
+ # Chef settings
28
+ server_url: "https://chef.int.example.com"
29
+
30
+ # Node Name
31
+ # Defaults to the instance-id if not present
32
+ node_name: "<%= hostname %>.<%= env %>"
33
+
34
+ # Environment
35
+ # Defaults to '_default' if not present
36
+ environment: "<%= env %>"
37
+
38
+ # Default validation name is chef-validator
39
+ validation_name: "chef-validator"
40
+ validation_key: |
41
+ -----BEGIN RSA PRIVATE KEY-----
42
+ -----END RSA PRIVATE KEY-----
43
+
44
+ # A run list for a first boot json
45
+ run_list:
46
+ <% if roles -%>
47
+ <% roles.each do |role| %>
48
+ - "role[<%= role %>]"
49
+ <% end -%>
50
+ <% end -%>
51
+ <% if recipes -%>
52
+ <% recipes.each do |recipe| %>
53
+ - "recipe[<%= recipe %>]"
54
+ <% end -%>
55
+ <% end -%>
56
+
57
+ runcmd:
58
+ - [ chef-client ]
59
+
60
+ # Capture all subprocess output into a logfile
61
+ # Useful for troubleshooting cloud-init issues
62
+ output: {all: '| tee -a /var/log/cloud-init-output.log'}
63
+
@@ -0,0 +1,16 @@
1
+ ---
2
+ test:
3
+ vpc_id: vpc-ada2d4c8
4
+ region_name: us-east-1
5
+ zone: Z2IOTRJNNABNJ
6
+ octet: '203'
7
+ domain: example.com
8
+ linux_cloud_config_template: cloud-config-example.erb
9
+ linux_paravirtual_base_image: ami-280d0740
10
+ linux_hvm_base_image: ami-260d074e
11
+ windows_cloud_config_template: cloud-config-example.erb
12
+ windows_paravirtual_base_image: ami-78bce2lm
13
+ windows_hvm_base_image: ami-9231e2fa
14
+ chef_host: 'https://chef.test.example.com:443'
15
+ products:
16
+ - sample-api
@@ -0,0 +1,37 @@
1
+ ---
2
+ - sample-api-1:
3
+ type:
4
+ prod: m3.medium
5
+ staging: m3.medium
6
+ ami: ami-123123
7
+ family: linux
8
+ ip: 10.OCTET.41.21
9
+ az: us-east-1c
10
+ environment:
11
+ - staging
12
+ security_groups:
13
+ - sample-api-server
14
+ chef_recipes:
15
+ - srv_sample_api
16
+ - sample-api-2:
17
+ type:
18
+ prod: m3.medium
19
+ staging: m3.medium
20
+ family: linux
21
+ ip: 10.OCTET.42.21
22
+ az: us-east-1d
23
+ security_groups:
24
+ - sample-api-server
25
+ chef_recipes:
26
+ - srv_sample_api
27
+ - sample-api-3:
28
+ type:
29
+ prod: m3.medium
30
+ staging: m3.medium
31
+ family: linux
32
+ ip: 10.OCTET.43.21
33
+ az: us-east-1e
34
+ security_groups:
35
+ - sample-api-server
36
+ chef_recipes:
37
+ - srv_sample_api
@@ -0,0 +1,19 @@
1
+ ---
2
+ - sample-api-load-balancer:
3
+ ingress:
4
+ -
5
+ source: 0.0.0.0/0
6
+ ports: 80
7
+ protocol: tcp
8
+ egress:
9
+ -
10
+ destination: sample-api-server
11
+ ports: 8080
12
+ protocol: tcp
13
+ - sample-api-server:
14
+ ingress:
15
+ -
16
+ source: sample-api-load-balancer
17
+ ports: 8080
18
+ protocol: tcp
19
+ egress:
@@ -0,0 +1,7 @@
1
+ ---
2
+ access_key_id: DUMMY_ACCESS_KEY
3
+ secret_access_key: DUMMY_SECRET_KEY
4
+ configuration_path: test/puke
5
+ key_pair_name: ci@example.com
6
+ chef_client_key: ci.pem
7
+ chef_client_name: ci
data/vominator.gemspec ADDED
@@ -0,0 +1,34 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vominator/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'vominator'
8
+ spec.version = Vominator::VERSION
9
+ spec.authors = ['Chris Kelly', 'Kevin Loukinen', 'Chris McNabb']
10
+ spec.email = ['chris@chris-kelly.net', 'kevin@loki.net', 'raizyr@gmail.com']
11
+ spec.summary = %q{Manage AWS resources from JSON templates and CLI.}
12
+ spec.description = %q{Leverage the power of CLI with your favorite revision control system to create and manage AWS infrastructure.}
13
+ spec.homepage = ''
14
+ spec.license = 'gplv3'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = %w{vominate}
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.required_ruby_version = '>= 2.0'
22
+
23
+ spec.add_dependency 'aws-sdk', '= 2.2.18'
24
+ spec.add_dependency 'colored', '~> 1.2'
25
+ spec.add_dependency 'highline', '~> 1.7'
26
+ spec.add_dependency 'erubis', '~> 2.7'
27
+ spec.add_dependency 'terminal-table', '~> 1.5.2'
28
+ spec.add_development_dependency 'bundler', '~> 1.6'
29
+ spec.add_development_dependency 'rake'
30
+ spec.add_development_dependency 'rspec'
31
+ spec.add_development_dependency 'rspec_junit_formatter'
32
+ spec.add_development_dependency 'simplecov'
33
+ spec.add_development_dependency 'pry'
34
+ end
metadata ADDED
@@ -0,0 +1,259 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vominator
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Chris Kelly
8
+ - Kevin Loukinen
9
+ - Chris McNabb
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2016-02-24 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: aws-sdk
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - '='
20
+ - !ruby/object:Gem::Version
21
+ version: 2.2.18
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - '='
27
+ - !ruby/object:Gem::Version
28
+ version: 2.2.18
29
+ - !ruby/object:Gem::Dependency
30
+ name: colored
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - "~>"
34
+ - !ruby/object:Gem::Version
35
+ version: '1.2'
36
+ type: :runtime
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '1.2'
43
+ - !ruby/object:Gem::Dependency
44
+ name: highline
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '1.7'
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - "~>"
55
+ - !ruby/object:Gem::Version
56
+ version: '1.7'
57
+ - !ruby/object:Gem::Dependency
58
+ name: erubis
59
+ requirement: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - "~>"
62
+ - !ruby/object:Gem::Version
63
+ version: '2.7'
64
+ type: :runtime
65
+ prerelease: false
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - "~>"
69
+ - !ruby/object:Gem::Version
70
+ version: '2.7'
71
+ - !ruby/object:Gem::Dependency
72
+ name: terminal-table
73
+ requirement: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - "~>"
76
+ - !ruby/object:Gem::Version
77
+ version: 1.5.2
78
+ type: :runtime
79
+ prerelease: false
80
+ version_requirements: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - "~>"
83
+ - !ruby/object:Gem::Version
84
+ version: 1.5.2
85
+ - !ruby/object:Gem::Dependency
86
+ name: bundler
87
+ requirement: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - "~>"
90
+ - !ruby/object:Gem::Version
91
+ version: '1.6'
92
+ type: :development
93
+ prerelease: false
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - "~>"
97
+ - !ruby/object:Gem::Version
98
+ version: '1.6'
99
+ - !ruby/object:Gem::Dependency
100
+ name: rake
101
+ requirement: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ type: :development
107
+ prerelease: false
108
+ version_requirements: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ - !ruby/object:Gem::Dependency
114
+ name: rspec
115
+ requirement: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ type: :development
121
+ prerelease: false
122
+ version_requirements: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ - !ruby/object:Gem::Dependency
128
+ name: rspec_junit_formatter
129
+ requirement: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ - !ruby/object:Gem::Dependency
142
+ name: simplecov
143
+ requirement: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ type: :development
149
+ prerelease: false
150
+ version_requirements: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - ">="
153
+ - !ruby/object:Gem::Version
154
+ version: '0'
155
+ - !ruby/object:Gem::Dependency
156
+ name: pry
157
+ requirement: !ruby/object:Gem::Requirement
158
+ requirements:
159
+ - - ">="
160
+ - !ruby/object:Gem::Version
161
+ version: '0'
162
+ type: :development
163
+ prerelease: false
164
+ version_requirements: !ruby/object:Gem::Requirement
165
+ requirements:
166
+ - - ">="
167
+ - !ruby/object:Gem::Version
168
+ version: '0'
169
+ description: Leverage the power of CLI with your favorite revision control system
170
+ to create and manage AWS infrastructure.
171
+ email:
172
+ - chris@chris-kelly.net
173
+ - kevin@loki.net
174
+ - raizyr@gmail.com
175
+ executables:
176
+ - vominate
177
+ extensions: []
178
+ extra_rdoc_files: []
179
+ files:
180
+ - ".gitignore"
181
+ - ".rspec"
182
+ - Gemfile
183
+ - LICENSE.txt
184
+ - README.md
185
+ - Rakefile
186
+ - bin/vominate
187
+ - circle.yml
188
+ - lib/ec2.rb
189
+ - lib/ec2/instances.rb
190
+ - lib/ec2/security_groups.rb
191
+ - lib/ec2/ssm.rb
192
+ - lib/vominator/aws.rb
193
+ - lib/vominator/constants.rb
194
+ - lib/vominator/ec2.rb
195
+ - lib/vominator/instances.rb
196
+ - lib/vominator/route53.rb
197
+ - lib/vominator/security_groups.rb
198
+ - lib/vominator/ssm.rb
199
+ - lib/vominator/version.rb
200
+ - lib/vominator/vominator.rb
201
+ - lib/vominator/vpc.rb
202
+ - lib/vpc.rb
203
+ - lib/vpc/create.rb
204
+ - spec/lib/instances_spec.rb
205
+ - spec/lib/vominator/aws_spec.rb
206
+ - spec/lib/vominator/ec2_spec.rb
207
+ - spec/lib/vominator/instances_spec.rb
208
+ - spec/lib/vominator/route53_spec.rb
209
+ - spec/lib/vominator/ssm_spec.rb
210
+ - spec/lib/vominator/vominator_spec.rb
211
+ - spec/spec_helper.rb
212
+ - spec/support/matchers/exit_with_code.rb
213
+ - test/puke/cloud-configs/.gitkeep
214
+ - test/puke/cloud-configs/cloud-config-example.erb
215
+ - test/puke/config.yaml
216
+ - test/puke/products/sample-api/instances.yaml
217
+ - test/puke/products/sample-api/security_groups.yaml
218
+ - test/vominator.yaml
219
+ - vominator.gemspec
220
+ homepage: ''
221
+ licenses:
222
+ - gplv3
223
+ metadata: {}
224
+ post_install_message:
225
+ rdoc_options: []
226
+ require_paths:
227
+ - lib
228
+ required_ruby_version: !ruby/object:Gem::Requirement
229
+ requirements:
230
+ - - ">="
231
+ - !ruby/object:Gem::Version
232
+ version: '2.0'
233
+ required_rubygems_version: !ruby/object:Gem::Requirement
234
+ requirements:
235
+ - - ">="
236
+ - !ruby/object:Gem::Version
237
+ version: '0'
238
+ requirements: []
239
+ rubyforge_project:
240
+ rubygems_version: 2.5.1
241
+ signing_key:
242
+ specification_version: 4
243
+ summary: Manage AWS resources from JSON templates and CLI.
244
+ test_files:
245
+ - spec/lib/instances_spec.rb
246
+ - spec/lib/vominator/aws_spec.rb
247
+ - spec/lib/vominator/ec2_spec.rb
248
+ - spec/lib/vominator/instances_spec.rb
249
+ - spec/lib/vominator/route53_spec.rb
250
+ - spec/lib/vominator/ssm_spec.rb
251
+ - spec/lib/vominator/vominator_spec.rb
252
+ - spec/spec_helper.rb
253
+ - spec/support/matchers/exit_with_code.rb
254
+ - test/puke/cloud-configs/.gitkeep
255
+ - test/puke/cloud-configs/cloud-config-example.erb
256
+ - test/puke/config.yaml
257
+ - test/puke/products/sample-api/instances.yaml
258
+ - test/puke/products/sample-api/security_groups.yaml
259
+ - test/vominator.yaml