wombat-cli 0.6.1 → 0.6.2

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