wombat-cli 0.2.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.
Files changed (201) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +19 -0
  3. data/DESIGN.md +40 -0
  4. data/Gemfile +3 -0
  5. data/README.md +132 -0
  6. data/Rakefile +52 -0
  7. data/Vagrantfile +121 -0
  8. data/bin/wombat +24 -0
  9. data/cookbooks/automate/.gitignore +16 -0
  10. data/cookbooks/automate/.kitchen.ec2.yml +27 -0
  11. data/cookbooks/automate/.kitchen.yml +25 -0
  12. data/cookbooks/automate/Berksfile +6 -0
  13. data/cookbooks/automate/README.md +4 -0
  14. data/cookbooks/automate/chefignore +102 -0
  15. data/cookbooks/automate/libraries/_helper.rb +52 -0
  16. data/cookbooks/automate/libraries/delivery_api.rb +204 -0
  17. data/cookbooks/automate/libraries/delivery_project.rb +31 -0
  18. data/cookbooks/automate/libraries/dsl.rb +5 -0
  19. data/cookbooks/automate/metadata.rb +13 -0
  20. data/cookbooks/automate/recipes/default.rb +111 -0
  21. data/cookbooks/automate/recipes/update-users.rb +48 -0
  22. data/cookbooks/automate/templates/delivery.erb +5 -0
  23. data/cookbooks/automate/test/fixtures/cookbooks/mock_data/files/automate.crt +26 -0
  24. data/cookbooks/automate/test/fixtures/cookbooks/mock_data/files/automate.key +27 -0
  25. data/cookbooks/automate/test/fixtures/cookbooks/mock_data/files/chef.crt +25 -0
  26. data/cookbooks/automate/test/fixtures/cookbooks/mock_data/files/chef.key +27 -0
  27. data/cookbooks/automate/test/fixtures/cookbooks/mock_data/files/compliance.crt +26 -0
  28. data/cookbooks/automate/test/fixtures/cookbooks/mock_data/files/compliance.key +27 -0
  29. data/cookbooks/automate/test/fixtures/cookbooks/mock_data/files/private.pem +27 -0
  30. data/cookbooks/automate/test/fixtures/cookbooks/mock_data/files/public.pub +1 -0
  31. data/cookbooks/automate/test/fixtures/cookbooks/mock_data/metadata.rb +3 -0
  32. data/cookbooks/automate/test/fixtures/cookbooks/mock_data/recipes/default.rb +27 -0
  33. data/cookbooks/automate/test/integration/default/automate_spec.rb +55 -0
  34. data/cookbooks/build_node/.gitignore +16 -0
  35. data/cookbooks/build_node/.kitchen.ec2.yml +30 -0
  36. data/cookbooks/build_node/.kitchen.yml +23 -0
  37. data/cookbooks/build_node/Berksfile +8 -0
  38. data/cookbooks/build_node/README.md +4 -0
  39. data/cookbooks/build_node/chefignore +102 -0
  40. data/cookbooks/build_node/metadata.rb +15 -0
  41. data/cookbooks/build_node/recipes/default.rb +35 -0
  42. data/cookbooks/build_node/templates/client.erb +3 -0
  43. data/cookbooks/build_node/test/fixtures/cookbooks/mock_data/files/automate.crt +26 -0
  44. data/cookbooks/build_node/test/fixtures/cookbooks/mock_data/files/automate.key +27 -0
  45. data/cookbooks/build_node/test/fixtures/cookbooks/mock_data/files/chef.crt +25 -0
  46. data/cookbooks/build_node/test/fixtures/cookbooks/mock_data/files/chef.key +27 -0
  47. data/cookbooks/build_node/test/fixtures/cookbooks/mock_data/files/compliance.crt +26 -0
  48. data/cookbooks/build_node/test/fixtures/cookbooks/mock_data/files/compliance.key +27 -0
  49. data/cookbooks/build_node/test/fixtures/cookbooks/mock_data/files/private.pem +27 -0
  50. data/cookbooks/build_node/test/fixtures/cookbooks/mock_data/files/public.pub +1 -0
  51. data/cookbooks/build_node/test/fixtures/cookbooks/mock_data/metadata.rb +2 -0
  52. data/cookbooks/build_node/test/fixtures/cookbooks/mock_data/recipes/default.rb +18 -0
  53. data/cookbooks/build_node/test/integration/default/build-node_spec.rb +39 -0
  54. data/cookbooks/chef_server/.gitignore +16 -0
  55. data/cookbooks/chef_server/.kitchen.ec2.yml +26 -0
  56. data/cookbooks/chef_server/.kitchen.yml +25 -0
  57. data/cookbooks/chef_server/Berksfile +6 -0
  58. data/cookbooks/chef_server/README.md +4 -0
  59. data/cookbooks/chef_server/chefignore +102 -0
  60. data/cookbooks/chef_server/metadata.rb +13 -0
  61. data/cookbooks/chef_server/recipes/cheffish.rb +91 -0
  62. data/cookbooks/chef_server/recipes/default.rb +79 -0
  63. data/cookbooks/chef_server/test/fixtures/cookbooks/mock_data/files/automate.crt +26 -0
  64. data/cookbooks/chef_server/test/fixtures/cookbooks/mock_data/files/automate.key +27 -0
  65. data/cookbooks/chef_server/test/fixtures/cookbooks/mock_data/files/chef.crt +25 -0
  66. data/cookbooks/chef_server/test/fixtures/cookbooks/mock_data/files/chef.key +27 -0
  67. data/cookbooks/chef_server/test/fixtures/cookbooks/mock_data/files/compliance.crt +26 -0
  68. data/cookbooks/chef_server/test/fixtures/cookbooks/mock_data/files/compliance.key +27 -0
  69. data/cookbooks/chef_server/test/fixtures/cookbooks/mock_data/files/private.pem +27 -0
  70. data/cookbooks/chef_server/test/fixtures/cookbooks/mock_data/files/public.pub +1 -0
  71. data/cookbooks/chef_server/test/fixtures/cookbooks/mock_data/metadata.rb +2 -0
  72. data/cookbooks/chef_server/test/fixtures/cookbooks/mock_data/recipes/default.rb +23 -0
  73. data/cookbooks/chef_server/test/integration/default/chef_server_spec.rb +47 -0
  74. data/cookbooks/compliance/.gitignore +16 -0
  75. data/cookbooks/compliance/.kitchen.ec2.yml +26 -0
  76. data/cookbooks/compliance/.kitchen.yml +24 -0
  77. data/cookbooks/compliance/Berksfile +7 -0
  78. data/cookbooks/compliance/README.md +4 -0
  79. data/cookbooks/compliance/chefignore +102 -0
  80. data/cookbooks/compliance/metadata.rb +12 -0
  81. data/cookbooks/compliance/recipes/default.rb +59 -0
  82. data/cookbooks/compliance/spec/spec_helper.rb +2 -0
  83. data/cookbooks/compliance/spec/unit/recipes/default_spec.rb +20 -0
  84. data/cookbooks/compliance/templates/default/chef-compliance.rb.erb +1 -0
  85. data/cookbooks/compliance/test/fixtures/cookbooks/mock_data/files/automate.crt +26 -0
  86. data/cookbooks/compliance/test/fixtures/cookbooks/mock_data/files/automate.key +27 -0
  87. data/cookbooks/compliance/test/fixtures/cookbooks/mock_data/files/chef.crt +25 -0
  88. data/cookbooks/compliance/test/fixtures/cookbooks/mock_data/files/chef.key +27 -0
  89. data/cookbooks/compliance/test/fixtures/cookbooks/mock_data/files/compliance.crt +26 -0
  90. data/cookbooks/compliance/test/fixtures/cookbooks/mock_data/files/compliance.key +27 -0
  91. data/cookbooks/compliance/test/fixtures/cookbooks/mock_data/files/private.pem +27 -0
  92. data/cookbooks/compliance/test/fixtures/cookbooks/mock_data/files/public.pub +1 -0
  93. data/cookbooks/compliance/test/fixtures/cookbooks/mock_data/metadata.rb +4 -0
  94. data/cookbooks/compliance/test/fixtures/cookbooks/mock_data/recipes/default.rb +21 -0
  95. data/cookbooks/compliance/test/integration/default/compliance.rb +27 -0
  96. data/cookbooks/infranodes/.gitignore +16 -0
  97. data/cookbooks/infranodes/.kitchen.ec2.yml +27 -0
  98. data/cookbooks/infranodes/.kitchen.yml +21 -0
  99. data/cookbooks/infranodes/Berksfile +6 -0
  100. data/cookbooks/infranodes/README.md +4 -0
  101. data/cookbooks/infranodes/attributes/default.rb +3 -0
  102. data/cookbooks/infranodes/chefignore +102 -0
  103. data/cookbooks/infranodes/metadata.rb +13 -0
  104. data/cookbooks/infranodes/recipes/default.rb +41 -0
  105. data/cookbooks/infranodes/spec/spec_helper.rb +2 -0
  106. data/cookbooks/infranodes/spec/unit/recipes/default_spec.rb +20 -0
  107. data/cookbooks/infranodes/templates/default/client.rb.erb +5 -0
  108. data/cookbooks/infranodes/test/fixtures/cookbooks/mock_data/files/automate.crt +26 -0
  109. data/cookbooks/infranodes/test/fixtures/cookbooks/mock_data/files/automate.key +27 -0
  110. data/cookbooks/infranodes/test/fixtures/cookbooks/mock_data/files/chef.crt +25 -0
  111. data/cookbooks/infranodes/test/fixtures/cookbooks/mock_data/files/chef.key +27 -0
  112. data/cookbooks/infranodes/test/fixtures/cookbooks/mock_data/files/compliance.crt +26 -0
  113. data/cookbooks/infranodes/test/fixtures/cookbooks/mock_data/files/compliance.key +27 -0
  114. data/cookbooks/infranodes/test/fixtures/cookbooks/mock_data/files/private.pem +27 -0
  115. data/cookbooks/infranodes/test/fixtures/cookbooks/mock_data/files/public.pub +1 -0
  116. data/cookbooks/infranodes/test/fixtures/cookbooks/mock_data/metadata.rb +3 -0
  117. data/cookbooks/infranodes/test/fixtures/cookbooks/mock_data/recipes/default.rb +21 -0
  118. data/cookbooks/infranodes/test/integration/default/infranodes_spec.rb +20 -0
  119. data/cookbooks/infranodes/test/integration/helpers/serverspec/spec_helper.rb +8 -0
  120. data/cookbooks/wombat/.gitignore +16 -0
  121. data/cookbooks/wombat/.kitchen.yml +43 -0
  122. data/cookbooks/wombat/Berksfile +6 -0
  123. data/cookbooks/wombat/README.md +4 -0
  124. data/cookbooks/wombat/attributes/default.rb +71 -0
  125. data/cookbooks/wombat/attributes/packer.rb +18 -0
  126. data/cookbooks/wombat/chefignore +102 -0
  127. data/cookbooks/wombat/metadata.rb +11 -0
  128. data/cookbooks/wombat/recipes/authorized-keys.rb +10 -0
  129. data/cookbooks/wombat/recipes/default.rb +112 -0
  130. data/cookbooks/wombat/recipes/etc-hosts.rb +51 -0
  131. data/cookbooks/workstation/.gitignore +16 -0
  132. data/cookbooks/workstation/.kitchen.ec2.yml +29 -0
  133. data/cookbooks/workstation/.kitchen.yml +22 -0
  134. data/cookbooks/workstation/Berksfile +7 -0
  135. data/cookbooks/workstation/README.md +3 -0
  136. data/cookbooks/workstation/chefignore +102 -0
  137. data/cookbooks/workstation/files/atom.apm.list +7 -0
  138. data/cookbooks/workstation/files/atom.config.cson +3 -0
  139. data/cookbooks/workstation/files/cmder.xml +605 -0
  140. data/cookbooks/workstation/metadata.rb +14 -0
  141. data/cookbooks/workstation/recipes/browser.rb +45 -0
  142. data/cookbooks/workstation/recipes/certs-keys.rb +44 -0
  143. data/cookbooks/workstation/recipes/chef.rb +29 -0
  144. data/cookbooks/workstation/recipes/default.rb +16 -0
  145. data/cookbooks/workstation/recipes/dotnet.rb +17 -0
  146. data/cookbooks/workstation/recipes/editor.rb +19 -0
  147. data/cookbooks/workstation/recipes/profile.rb +42 -0
  148. data/cookbooks/workstation/recipes/terminal.rb +13 -0
  149. data/cookbooks/workstation/templates/default/bookmarks.html.erb +23 -0
  150. data/cookbooks/workstation/templates/default/data_collector.rb.erb +2 -0
  151. data/cookbooks/workstation/templates/default/ise_profile.ps1.erb +11 -0
  152. data/cookbooks/workstation/templates/default/knife.rb.erb +10 -0
  153. data/cookbooks/workstation/templates/default/master_preferences.json.erb +28 -0
  154. data/cookbooks/workstation/templates/default/ssh_config.erb +16 -0
  155. data/cookbooks/workstation/test/fixtures/cookbooks/mock_data/files/chef-server.crt +26 -0
  156. data/cookbooks/workstation/test/fixtures/cookbooks/mock_data/files/chef-server.key +27 -0
  157. data/cookbooks/workstation/test/fixtures/cookbooks/mock_data/files/compliance.crt +26 -0
  158. data/cookbooks/workstation/test/fixtures/cookbooks/mock_data/files/compliance.key +27 -0
  159. data/cookbooks/workstation/test/fixtures/cookbooks/mock_data/files/delivery.crt +26 -0
  160. data/cookbooks/workstation/test/fixtures/cookbooks/mock_data/files/delivery.key +27 -0
  161. data/cookbooks/workstation/test/fixtures/cookbooks/mock_data/files/private.pem +27 -0
  162. data/cookbooks/workstation/test/fixtures/cookbooks/mock_data/files/public.pub +1 -0
  163. data/cookbooks/workstation/test/fixtures/cookbooks/mock_data/metadata.rb +2 -0
  164. data/cookbooks/workstation/test/fixtures/cookbooks/mock_data/recipes/default.rb +21 -0
  165. data/cookbooks/workstation/test/integration/default/workstation_spec.rb +37 -0
  166. data/keys/.gitkeep +0 -0
  167. data/lib/wombat/build.rb +195 -0
  168. data/lib/wombat/cli.rb +169 -0
  169. data/lib/wombat/common.rb +163 -0
  170. data/lib/wombat/delete.rb +28 -0
  171. data/lib/wombat/deploy.rb +105 -0
  172. data/lib/wombat/output.rb +45 -0
  173. data/lib/wombat/version.rb +3 -0
  174. data/lib/wombat.rb +8 -0
  175. data/logs/.gitkeep +0 -0
  176. data/packer/automate.json +108 -0
  177. data/packer/build-node.json +114 -0
  178. data/packer/chef-server.json +106 -0
  179. data/packer/compliance.json +106 -0
  180. data/packer/files/.gitkeep +0 -0
  181. data/packer/infranodes.json +108 -0
  182. data/packer/mock-data/.gitignore +16 -0
  183. data/packer/mock-data/.kitchen.yml +21 -0
  184. data/packer/mock-data/Berksfile +3 -0
  185. data/packer/mock-data/README.md +4 -0
  186. data/packer/mock-data/chefignore +102 -0
  187. data/packer/mock-data/metadata.rb +7 -0
  188. data/packer/mock-data/recipes/default.rb +69 -0
  189. data/packer/mock-data/spec/spec_helper.rb +2 -0
  190. data/packer/mock-data/spec/unit/recipes/default_spec.rb +20 -0
  191. data/packer/mock-data/test/integration/default/serverspec/default_spec.rb +9 -0
  192. data/packer/mock-data/test/integration/helpers/serverspec/spec_helper.rb +8 -0
  193. data/packer/workstation.json +97 -0
  194. data/templates/bootstrap-aws.erb +36 -0
  195. data/templates/cfn.json.erb +661 -0
  196. data/terraform/README.md +13 -0
  197. data/terraform/templates/terraform.tfvars.erb +12 -0
  198. data/terraform/wombat.tf +328 -0
  199. data/wombat-cli.gemspec +32 -0
  200. data/wombat.example.yml +52 -0
  201. metadata +331 -0
@@ -0,0 +1,661 @@
1
+
2
+ {
3
+ "AWSTemplateFormatVersion": "2010-09-09",
4
+ "Description": "wombat",
5
+ "Parameters": {
6
+ "AvailabilityZone": {
7
+ "Description": "Availability Zone",
8
+ "Type": "String",
9
+ "Default": "<%= @availability_zone %>"
10
+ },
11
+ "DemoName": {
12
+ "Description": "Name of the customer or organization",
13
+ "Type": "String",
14
+ "Default": "<%= @demo %>"
15
+ },
16
+ "Version": {
17
+ "Description": "Version",
18
+ "Type": "String",
19
+ "Default": "<%= @version %>"
20
+ },
21
+ "KeyName": {
22
+ "Description": "Name of an existing ec2 KeyPair to enable SSH access",
23
+ "Type": "AWS::EC2::KeyPair::KeyName",
24
+ "ConstraintDescription": "must be the name of an existing EC2 KeyPair."
25
+ },
26
+ "SSHLocation": {
27
+ "Description": "The IP address range that can be used to SSH to the EC2 instances",
28
+ "Type": "String",
29
+ "MinLength": "9",
30
+ "MaxLength": "18",
31
+ "Default": "0.0.0.0/0",
32
+ "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
33
+ "ConstraintDescription": "must be a valid IP CIDR range of the form x.x.x.x/x."
34
+ },
35
+ "TTL": {
36
+ "Description": "Time in hours for the demo to stay active. Default is 4, maximum is 720 hours (30 days).",
37
+ "Type": "Number",
38
+ "Default": <%= @ttl %>,
39
+ "MinValue": 0,
40
+ "MaxValue": 720
41
+ },
42
+ "ChefServerAMI": {
43
+ "Type": "String",
44
+ "Default": "<%= @chef_server_ami %>",
45
+ "Description": "AMI ID for the Chef Server"
46
+ },
47
+ "AutomateAMI": {
48
+ "Type": "String",
49
+ "Default": "<%= @automate_ami %>",
50
+ "Description": "AMI ID for the Automate Server"
51
+ },
52
+ "ComplianceAMI": {
53
+ "Type": "String",
54
+ "Default": "<%= @compliance_ami %>",
55
+ "Description": "AMI ID for the Compliance Server"
56
+ },
57
+ <% 1.upto(@build_nodes) do |i| -%>
58
+ "BuildNode<%= i.to_s %>AMI": {
59
+ "Type": "String",
60
+ "Default": "<%= @build_node_ami[i] %>",
61
+ "Description": "AMI ID for Build Node <%= i %>"
62
+ },
63
+ <% end -%>
64
+ <% @infra.each do |name, ami| -%>
65
+ "<%= name %>AMI": {
66
+ "Type": "String",
67
+ "Default": "<%= ami %>",
68
+ "Description": "AMI ID for <%= name %>"
69
+ },
70
+ <% end -%>
71
+ <% 1.upto(@workstations) do |i| -%>
72
+ "WindowsWorkstation<%= i.to_s %>AMI": {
73
+ "Type": "String",
74
+ "Default": "<%= @workstation_ami[i] %>",
75
+ "Description": "AMI ID for the Windows Workstation"
76
+ }
77
+ <% end -%>
78
+ },
79
+ "Resources": {
80
+ "VPC": {
81
+ "Type": "AWS::EC2::VPC",
82
+ "Properties": {
83
+ "CidrBlock": "172.31.0.0/16",
84
+ "EnableDnsSupport": "true",
85
+ "EnableDnsHostnames": "true",
86
+ "Tags": [
87
+ {
88
+ "Key": "Application",
89
+ "Value": {
90
+ "Ref": "AWS::StackId"
91
+ },
92
+ "Key": "Name",
93
+ "Value": {
94
+ "Fn::Join" : [ " ", [ { "Ref": "DemoName" }, "VPC" ] ]
95
+ }
96
+ }
97
+ ]
98
+ }
99
+ },
100
+ "SubnetAutomate": {
101
+ "Type": "AWS::EC2::Subnet",
102
+ "Properties": {
103
+ "AvailabilityZone": { "Ref": "AvailabilityZone" },
104
+ "VpcId": {
105
+ "Ref": "VPC"
106
+ },
107
+ "CidrBlock": "172.31.54.0/24",
108
+ "Tags": [
109
+ {
110
+ "Key": "Application",
111
+ "Value": {
112
+ "Ref": "AWS::StackId"
113
+ },
114
+ "Key": "Name",
115
+ "Value": {
116
+ "Fn::Join" : [ " ", [ { "Ref": "DemoName" }, "Automate Subnet" ] ]
117
+ }
118
+ }
119
+ ]
120
+ }
121
+ },
122
+ "SubnetProd": {
123
+ "Type": "AWS::EC2::Subnet",
124
+ "Properties": {
125
+ "AvailabilityZone": { "Ref": "AvailabilityZone" },
126
+ "VpcId": {
127
+ "Ref": "VPC"
128
+ },
129
+ "CidrBlock": "172.31.62.0/24",
130
+ "Tags": [
131
+ {
132
+ "Key": "Application",
133
+ "Value": {
134
+ "Ref": "AWS::StackId"
135
+ },
136
+ "Key": "Name",
137
+ "Value": {
138
+ "Fn::Join" : [ " ", [ { "Ref": "DemoName" }, "Prod Subnet" ] ]
139
+ }
140
+ }
141
+ ]
142
+ }
143
+ },
144
+ "SubnetWorkstations": {
145
+ "Type": "AWS::EC2::Subnet",
146
+ "Properties": {
147
+ "AvailabilityZone": { "Ref": "AvailabilityZone" },
148
+ "VpcId": {
149
+ "Ref": "VPC"
150
+ },
151
+ "CidrBlock": "172.31.10.0/24",
152
+ "Tags": [
153
+ {
154
+ "Key": "Application",
155
+ "Value": {
156
+ "Ref": "AWS::StackId"
157
+ },
158
+ "Key": "Name",
159
+ "Value": {
160
+ "Fn::Join" : [ " ", [ { "Ref": "DemoName" }, "Workstations Subnet" ] ]
161
+ }
162
+ }
163
+ ]
164
+ }
165
+ },
166
+ "InternetGateway": {
167
+ "Type": "AWS::EC2::InternetGateway",
168
+ "Properties": {
169
+ "Tags": [
170
+ {
171
+ "Key": "Application",
172
+ "Value": {
173
+ "Ref": "AWS::StackId"
174
+ },
175
+ "Key": "Name",
176
+ "Value": {
177
+ "Fn::Join" : [ " ", [ { "Ref": "DemoName" }, " IG" ] ]
178
+ }
179
+ }
180
+ ]
181
+ }
182
+ },
183
+ "AttachGateway": {
184
+ "Type": "AWS::EC2::VPCGatewayAttachment",
185
+ "Properties": {
186
+ "VpcId": {
187
+ "Ref": "VPC"
188
+ },
189
+ "InternetGatewayId": {
190
+ "Ref": "InternetGateway"
191
+ }
192
+ }
193
+ },
194
+ "RouteTable": {
195
+ "Type": "AWS::EC2::RouteTable",
196
+ "Properties": {
197
+ "VpcId": {
198
+ "Ref": "VPC"
199
+ },
200
+ "Tags": [
201
+ {
202
+ "Key": "Application",
203
+ "Value": {
204
+ "Ref": "AWS::StackId"
205
+ },
206
+ "Key": "Name",
207
+ "Value": {
208
+ "Fn::Join" : [ " ", [ { "Ref": "DemoName" }, "Demo RouteTable" ] ]
209
+ }
210
+ }
211
+ ]
212
+ }
213
+ },
214
+ "Route": {
215
+ "Type": "AWS::EC2::Route",
216
+ "DependsOn": "AttachGateway",
217
+ "Properties": {
218
+ "RouteTableId": {
219
+ "Ref": "RouteTable"
220
+ },
221
+ "DestinationCidrBlock": "0.0.0.0/0",
222
+ "GatewayId": {
223
+ "Ref": "InternetGateway"
224
+ }
225
+ }
226
+ },
227
+ "SubnetRouteTableAssociationAutomate": {
228
+ "Type": "AWS::EC2::SubnetRouteTableAssociation",
229
+ "Properties": {
230
+ "SubnetId": {
231
+ "Ref": "SubnetAutomate"
232
+ },
233
+ "RouteTableId": {
234
+ "Ref": "RouteTable"
235
+ }
236
+ }
237
+ },
238
+ "SubnetRouteTableAssociationProd": {
239
+ "Type": "AWS::EC2::SubnetRouteTableAssociation",
240
+ "Properties": {
241
+ "SubnetId": {
242
+ "Ref": "SubnetProd"
243
+ },
244
+ "RouteTableId": {
245
+ "Ref": "RouteTable"
246
+ }
247
+ }
248
+ },
249
+ "SubnetRouteTableAssociationWorkstations": {
250
+ "Type": "AWS::EC2::SubnetRouteTableAssociation",
251
+ "Properties": {
252
+ "SubnetId": {
253
+ "Ref": "SubnetWorkstations"
254
+ },
255
+ "RouteTableId": {
256
+ "Ref": "RouteTable"
257
+ }
258
+ }
259
+ },
260
+ "NetworkAcl": {
261
+ "Type": "AWS::EC2::NetworkAcl",
262
+ "Properties": {
263
+ "VpcId": {
264
+ "Ref": "VPC"
265
+ },
266
+ "Tags": [
267
+ {
268
+ "Key": "Application",
269
+ "Value": {
270
+ "Ref": "AWS::StackId"
271
+ },
272
+ "Key": "Name",
273
+ "Value": {
274
+ "Fn::Join" : [ " ", [ { "Ref": "DemoName" }, "NetworkAcl" ] ]
275
+ }
276
+ }
277
+ ]
278
+ }
279
+ },
280
+ "InboundNetworkAclEntry": {
281
+ "Type": "AWS::EC2::NetworkAclEntry",
282
+ "Properties": {
283
+ "NetworkAclId": {
284
+ "Ref": "NetworkAcl"
285
+ },
286
+ "RuleNumber": "100",
287
+ "Protocol": "-1",
288
+ "RuleAction": "allow",
289
+ "Egress": "false",
290
+ "CidrBlock": "0.0.0.0/0"
291
+ }
292
+ },
293
+ "OutBoundNetworkAclEntry": {
294
+ "Type": "AWS::EC2::NetworkAclEntry",
295
+ "Properties": {
296
+ "NetworkAclId": {
297
+ "Ref": "NetworkAcl"
298
+ },
299
+ "RuleNumber": "100",
300
+ "Protocol": "-1",
301
+ "RuleAction": "allow",
302
+ "Egress": "true",
303
+ "CidrBlock": "0.0.0.0/0"
304
+ }
305
+ },
306
+ "SubnetNetworkAclAssociationAutomate": {
307
+ "Type": "AWS::EC2::SubnetNetworkAclAssociation",
308
+ "Properties": {
309
+ "SubnetId": {
310
+ "Ref": "SubnetAutomate"
311
+ },
312
+ "NetworkAclId": {
313
+ "Ref": "NetworkAcl"
314
+ }
315
+ }
316
+ },
317
+ "SubnetNetworkAclAssociationProd": {
318
+ "Type": "AWS::EC2::SubnetNetworkAclAssociation",
319
+ "Properties": {
320
+ "SubnetId": {
321
+ "Ref": "SubnetProd"
322
+ },
323
+ "NetworkAclId": {
324
+ "Ref": "NetworkAcl"
325
+ }
326
+ }
327
+ },
328
+ "SubnetNetworkAclAssociationPOCWorkstations": {
329
+ "Type": "AWS::EC2::SubnetNetworkAclAssociation",
330
+ "Properties": {
331
+ "SubnetId": {
332
+ "Ref": "SubnetWorkstations"
333
+ },
334
+ "NetworkAclId": {
335
+ "Ref": "NetworkAcl"
336
+ }
337
+ }
338
+ },
339
+ <% 1.upto(@workstations) do |i| -%>
340
+ "WindowsWorkstation<%= i.to_s %>": {
341
+ "Type": "AWS::EC2::Instance",
342
+ "Properties": {
343
+ "InstanceType": "m3.large",
344
+ "AvailabilityZone": { "Ref": "AvailabilityZone" },
345
+ "NetworkInterfaces": [
346
+ {
347
+ "GroupSet": [
348
+ {
349
+ "Ref": "DemoSecurityGroup"
350
+ }
351
+ ],
352
+ "AssociatePublicIpAddress": "true",
353
+ "PrivateIpAddress": "172.31.54.<%= 200 + i %>",
354
+ "DeviceIndex": "0",
355
+ "DeleteOnTermination": "true",
356
+ "SubnetId": {
357
+ "Ref": "SubnetAutomate"
358
+ }
359
+ }
360
+ ],
361
+ "KeyName": {
362
+ "Ref": "KeyName"
363
+ },
364
+ "ImageId": {
365
+ "Ref": "WindowsWorkstation<%= i.to_s %>AMI"
366
+ },
367
+ "Tags": [
368
+ {
369
+ "Key": "Name",
370
+ "Value": {
371
+ "Fn::Join" : [ " ", [ { "Ref": "DemoName" }, "Workstation" ] ]
372
+ }
373
+ }
374
+ ]
375
+ }
376
+ },
377
+ <% end -%>
378
+ <% 1.upto(@build_nodes) do |i| -%>
379
+ "BuildNode<%= i.to_s %>": {
380
+ "Type": "AWS::EC2::Instance",
381
+ "Properties": {
382
+ "InstanceType": "m3.large",
383
+ "AvailabilityZone": { "Ref": "AvailabilityZone" },
384
+ "NetworkInterfaces": [
385
+ {
386
+ "GroupSet": [
387
+ {
388
+ "Ref": "DemoSecurityGroup"
389
+ }
390
+ ],
391
+ "AssociatePublicIpAddress": "true",
392
+ "PrivateIpAddress": "172.31.54.<%= 50 + i %>",
393
+ "DeviceIndex": "0",
394
+ "DeleteOnTermination": "true",
395
+ "SubnetId": {
396
+ "Ref": "SubnetAutomate"
397
+ }
398
+ }
399
+ ],
400
+ "KeyName": { "Ref": "KeyName" },
401
+ "UserData": { "Fn::Base64" : { "Fn::Join" : ["", [
402
+ "#!/bin/bash -xe\n",
403
+ "hostnamectl set-hostname build-node-<%= i.to_s %>\n"]]}
404
+ },
405
+ "ImageId": {
406
+ "Ref": "BuildNode<%= i.to_s %>AMI"
407
+ },
408
+ "Tags": [
409
+ {
410
+ "Key": "Name",
411
+ "Value": {
412
+ "Fn::Join" : [ " ", [ { "Ref": "DemoName" }, "Build Node <%= i.to_s %>" ] ]
413
+ }
414
+ }
415
+ ]
416
+ }
417
+ },
418
+ <% end -%>
419
+ <% @infra.sort.each do |name, _ami| -%>
420
+ "<%= name %>": {
421
+ "Type": "AWS::EC2::Instance",
422
+ "Properties": {
423
+ "InstanceType": "m3.large",
424
+ "AvailabilityZone": { "Ref": "AvailabilityZone" },
425
+ "NetworkInterfaces": [
426
+ {
427
+ "GroupSet": [
428
+ {
429
+ "Ref": "DemoSecurityGroup"
430
+ }
431
+ ],
432
+ "AssociatePublicIpAddress": "true",
433
+ "PrivateIpAddress": "172.31.54.<%= 101 + @infra.keys.find_index(name) %>",
434
+ "DeviceIndex": "0",
435
+ "DeleteOnTermination": "true",
436
+ "SubnetId": {
437
+ "Ref": "SubnetAutomate"
438
+ }
439
+ }
440
+ ],
441
+ "KeyName": { "Ref": "KeyName" },
442
+ "UserData": { "Fn::Base64" : { "Fn::Join" : ["", [
443
+ "#!/bin/bash -xe\n",
444
+ "hostnamectl set-hostname <%= name %>\n"]]}
445
+ },
446
+ "ImageId": {
447
+ "Ref": "<%= name %>AMI"
448
+ },
449
+ "Tags": [
450
+ {
451
+ "Key": "Name",
452
+ "Value": {
453
+ "Fn::Join" : [ " ", [ { "Ref": "DemoName" }, "<%= name %>" ] ]
454
+ }
455
+ }
456
+ ]
457
+ }
458
+ },
459
+ <% end -%>
460
+ "Chef": {
461
+ "Type": "AWS::EC2::Instance",
462
+ "Properties": {
463
+ "InstanceType": "c3.xlarge",
464
+ "AvailabilityZone": { "Ref": "AvailabilityZone" },
465
+ "BlockDeviceMappings" : [
466
+ {
467
+ "DeviceName" : "/dev/sda1",
468
+ "Ebs" : { "VolumeSize" : "50" }
469
+ }
470
+ ],
471
+ "NetworkInterfaces": [
472
+ {
473
+ "GroupSet": [
474
+ {
475
+ "Ref": "DemoSecurityGroup"
476
+ }
477
+ ],
478
+ "AssociatePublicIpAddress": "true",
479
+ "PrivateIpAddress": "172.31.54.10",
480
+ "DeviceIndex": "0",
481
+ "DeleteOnTermination": "true",
482
+ "SubnetId": {
483
+ "Ref": "SubnetAutomate"
484
+ }
485
+ }
486
+ ],
487
+ "KeyName": { "Ref": "KeyName" },
488
+ "UserData": { "Fn::Base64" : { "Fn::Join" : ["", [
489
+ "#!/bin/bash -xe\n",
490
+ "hostnamectl set-hostname chef\n",
491
+ "chef-server-ctl reconfigure\n"]]}
492
+ },
493
+ "ImageId": {
494
+ "Ref": "ChefServerAMI"
495
+ },
496
+ "Tags": [
497
+ {
498
+ "Key": "Name",
499
+ "Value": {
500
+ "Fn::Join" : [ " ", [ { "Ref": "DemoName" }, "Chef Server" ] ]
501
+ }
502
+ }
503
+ ]
504
+ }
505
+ },
506
+ "Automate": {
507
+ "Type": "AWS::EC2::Instance",
508
+ "Properties": {
509
+ "InstanceType": "c3.xlarge",
510
+ "AvailabilityZone": { "Ref": "AvailabilityZone" },
511
+ "BlockDeviceMappings" : [
512
+ {
513
+ "DeviceName" : "/dev/sda1",
514
+ "Ebs" : { "VolumeSize" : "50" }
515
+ }
516
+ ] ,
517
+ "NetworkInterfaces": [
518
+ {
519
+ "GroupSet": [
520
+ {
521
+ "Ref": "DemoSecurityGroup"
522
+ }
523
+ ],
524
+ "AssociatePublicIpAddress": "true",
525
+ "PrivateIpAddress": "172.31.54.11",
526
+ "DeviceIndex": "0",
527
+ "DeleteOnTermination": "true",
528
+ "SubnetId": {
529
+ "Ref": "SubnetAutomate"
530
+ }
531
+ }
532
+ ],
533
+ "KeyName": { "Ref": "KeyName" },
534
+ "UserData": { "Fn::Base64" : { "Fn::Join" : ["", [
535
+ "#!/bin/bash -xe\n",
536
+ "hostnamectl set-hostname automate\n",
537
+ "delivery-ctl reconfigure\n"]]}
538
+ },
539
+ "ImageId": {
540
+ "Ref": "AutomateAMI"
541
+ },
542
+ "Tags": [
543
+ {
544
+ "Key": "Name",
545
+ "Value": {
546
+ "Fn::Join" : [ " ", [ { "Ref": "DemoName" }, "Automate Server" ] ]
547
+ }
548
+ }
549
+ ]
550
+ }
551
+ },
552
+ "Compliance": {
553
+ "Type": "AWS::EC2::Instance",
554
+ "Properties": {
555
+ "InstanceType": "c3.large",
556
+ "AvailabilityZone": { "Ref": "AvailabilityZone" },
557
+ "BlockDeviceMappings" : [
558
+ {
559
+ "DeviceName" : "/dev/sda1",
560
+ "Ebs" : { "VolumeSize" : "8" }
561
+ }
562
+ ] ,
563
+ "NetworkInterfaces": [
564
+ {
565
+ "GroupSet": [
566
+ {
567
+ "Ref": "DemoSecurityGroup"
568
+ }
569
+ ],
570
+ "AssociatePublicIpAddress": "true",
571
+ "PrivateIpAddress": "172.31.54.12",
572
+ "DeviceIndex": "0",
573
+ "DeleteOnTermination": "true",
574
+ "SubnetId": {
575
+ "Ref": "SubnetAutomate"
576
+ }
577
+ }
578
+ ],
579
+ "KeyName": { "Ref": "KeyName" },
580
+ "UserData": { "Fn::Base64" : { "Fn::Join" : ["", [
581
+ "#!/bin/bash -xe\n",
582
+ "hostnamectl set-hostname compliance\n",
583
+ "chef-compliance-ctl reconfigure\n"]]}
584
+ },
585
+ "ImageId": {
586
+ "Ref": "ComplianceAMI"
587
+ },
588
+ "Tags": [
589
+ {
590
+ "Key": "Name",
591
+ "Value": {
592
+ "Fn::Join" : [ " ", [ { "Ref": "DemoName" }, "Compliance Server" ] ]
593
+ }
594
+ }
595
+ ]
596
+ }
597
+ },
598
+ "DemoSecurityGroup": {
599
+ "Type": "AWS::EC2::SecurityGroup",
600
+ "Properties": {
601
+ "VpcId": {
602
+ "Ref": "VPC"
603
+ },
604
+ "GroupDescription": "Enable required ports for Chef Server",
605
+ "SecurityGroupIngress": [
606
+ {
607
+ "IpProtocol": "tcp",
608
+ "FromPort": "22",
609
+ "ToPort": "22",
610
+ "CidrIp": {
611
+ "Ref": "SSHLocation"
612
+ }
613
+ },
614
+ {
615
+ "IpProtocol": "tcp",
616
+ "FromPort": "0",
617
+ "ToPort": "65535",
618
+ "CidrIp": "172.31.0.0/16"
619
+ },
620
+ {
621
+ "IpProtocol": "tcp",
622
+ "FromPort": "3389",
623
+ "ToPort": "3389",
624
+ "CidrIp": "0.0.0.0/0"
625
+ },
626
+ {
627
+ "IpProtocol": "tcp",
628
+ "FromPort": "443",
629
+ "ToPort": "443",
630
+ "CidrIp": "0.0.0.0/0"
631
+ },
632
+ {
633
+ "IpProtocol": "icmp",
634
+ "FromPort": "8",
635
+ "ToPort": "-1",
636
+ "CidrIp": "0.0.0.0/0"
637
+ },
638
+ {
639
+ "IpProtocol": "udp",
640
+ "FromPort": "3389",
641
+ "ToPort": "3389",
642
+ "CidrIp": "0.0.0.0/0"
643
+ }
644
+ ]
645
+ }
646
+ }
647
+ },
648
+ "Outputs": {
649
+ <% 1.upto(@workstations) do |i| -%>
650
+ "WindowsWorkstation<%= i.to_s %>PubDNS": {
651
+ "Description": "Public IP address of the Windows Workstation",
652
+ "Value": {
653
+ "Fn::GetAtt": [
654
+ "WindowsWorkstation<%= i.to_s %>",
655
+ "PublicIp"
656
+ ]
657
+ }
658
+ }
659
+ <% end -%>
660
+ }
661
+ }
@@ -0,0 +1,13 @@
1
+ # Terraform
2
+ - `wombat.tf` is a Terraform configuration for the wombat
3
+
4
+
5
+ ## Using Terraform
6
+ 1. Install Terraform https://www.terraform.io/downloads.html
7
+ 2. configure AWS keys for Terraform
8
+ - either with env vars `TF_VAR_access_key TF_VAR_secret_key` or a terraform.tfvars file
9
+ - https://gist.github.com/scarolan/60ae8a2d5f2a8fdb5c55
10
+ 3. `terraform plan` to see what resources would be built
11
+ 4. `terraform apply` to build (or update) resources
12
+ 5. `terraform output` to display outputs (in our case public IPs)
13
+ 6. `terraform destroy` to destroy resources
@@ -0,0 +1,12 @@
1
+ # We have to define these, but we leave them blank so that Terraform
2
+ # knows to read them from environment vars or ~/.aws/credentials
3
+ access_key = ""
4
+ secret_key = ""
5
+ key_name = ""
6
+ customer = "wombat"
7
+
8
+ # Default AMIs for building the demo
9
+ ami-chef-server = "<%= @chef_server_ami %>"
10
+ ami-automate = "<%= @automate_ami %>"
11
+ ami-build-node = "<%= @automate_builder_ami %>"
12
+ ami-workstation = "<%= @workstation_ami %>"