cloud-mu 2.1.0beta → 3.0.0beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (291) hide show
  1. checksums.yaml +5 -5
  2. data/Berksfile +4 -5
  3. data/Berksfile.lock +179 -0
  4. data/README.md +1 -6
  5. data/ansible/roles/geerlingguy.firewall/templates/firewall.bash.j2 +0 -0
  6. data/ansible/roles/mu-installer/README.md +33 -0
  7. data/ansible/roles/mu-installer/defaults/main.yml +2 -0
  8. data/ansible/roles/mu-installer/handlers/main.yml +2 -0
  9. data/ansible/roles/mu-installer/meta/main.yml +60 -0
  10. data/ansible/roles/mu-installer/tasks/main.yml +13 -0
  11. data/ansible/roles/mu-installer/tests/inventory +2 -0
  12. data/ansible/roles/mu-installer/tests/test.yml +5 -0
  13. data/ansible/roles/mu-installer/vars/main.yml +2 -0
  14. data/bin/mu-adopt +125 -0
  15. data/bin/mu-aws-setup +4 -4
  16. data/bin/mu-azure-setup +265 -0
  17. data/bin/mu-azure-tests +43 -0
  18. data/bin/mu-cleanup +20 -8
  19. data/bin/mu-configure +224 -98
  20. data/bin/mu-deploy +8 -3
  21. data/bin/mu-gcp-setup +16 -8
  22. data/bin/mu-gen-docs +92 -8
  23. data/bin/mu-load-config.rb +52 -12
  24. data/bin/mu-momma-cat +36 -0
  25. data/bin/mu-node-manage +34 -27
  26. data/bin/mu-self-update +2 -2
  27. data/bin/mu-ssh +12 -8
  28. data/bin/mu-upload-chef-artifacts +11 -4
  29. data/bin/mu-user-manage +3 -0
  30. data/cloud-mu.gemspec +8 -11
  31. data/cookbooks/firewall/libraries/helpers_iptables.rb +2 -2
  32. data/cookbooks/firewall/metadata.json +1 -1
  33. data/cookbooks/firewall/recipes/default.rb +5 -9
  34. data/cookbooks/mu-firewall/attributes/default.rb +2 -0
  35. data/cookbooks/mu-firewall/metadata.rb +1 -1
  36. data/cookbooks/mu-glusterfs/templates/default/mu-gluster-client.erb +0 -0
  37. data/cookbooks/mu-master/Berksfile +2 -2
  38. data/cookbooks/mu-master/files/default/check_mem.pl +0 -0
  39. data/cookbooks/mu-master/files/default/cloudamatic.png +0 -0
  40. data/cookbooks/mu-master/metadata.rb +5 -4
  41. data/cookbooks/mu-master/recipes/389ds.rb +1 -1
  42. data/cookbooks/mu-master/recipes/basepackages.rb +30 -10
  43. data/cookbooks/mu-master/recipes/default.rb +59 -7
  44. data/cookbooks/mu-master/recipes/firewall-holes.rb +1 -1
  45. data/cookbooks/mu-master/recipes/init.rb +65 -47
  46. data/cookbooks/mu-master/recipes/{eks-kubectl.rb → kubectl.rb} +4 -10
  47. data/cookbooks/mu-master/recipes/sssd.rb +2 -1
  48. data/cookbooks/mu-master/recipes/update_nagios_only.rb +6 -6
  49. data/cookbooks/mu-master/templates/default/web_app.conf.erb +2 -2
  50. data/cookbooks/mu-master/templates/mods/ldap.conf.erb +4 -0
  51. data/cookbooks/mu-php54/Berksfile +1 -2
  52. data/cookbooks/mu-php54/metadata.rb +4 -5
  53. data/cookbooks/mu-php54/recipes/default.rb +1 -1
  54. data/cookbooks/mu-splunk/templates/default/splunk-init.erb +0 -0
  55. data/cookbooks/mu-tools/Berksfile +3 -2
  56. data/cookbooks/mu-tools/files/default/Mu_CA.pem +33 -0
  57. data/cookbooks/mu-tools/libraries/helper.rb +20 -8
  58. data/cookbooks/mu-tools/metadata.rb +5 -2
  59. data/cookbooks/mu-tools/recipes/apply_security.rb +2 -3
  60. data/cookbooks/mu-tools/recipes/eks.rb +1 -1
  61. data/cookbooks/mu-tools/recipes/gcloud.rb +5 -30
  62. data/cookbooks/mu-tools/recipes/nagios.rb +1 -1
  63. data/cookbooks/mu-tools/recipes/rsyslog.rb +1 -0
  64. data/cookbooks/mu-tools/recipes/selinux.rb +19 -0
  65. data/cookbooks/mu-tools/recipes/split_var_partitions.rb +0 -1
  66. data/cookbooks/mu-tools/recipes/windows-client.rb +256 -122
  67. data/cookbooks/mu-tools/resources/disk.rb +3 -1
  68. data/cookbooks/mu-tools/templates/amazon/sshd_config.erb +1 -1
  69. data/cookbooks/mu-tools/templates/default/etc_hosts.erb +1 -1
  70. data/cookbooks/mu-tools/templates/default/{kubeconfig.erb → kubeconfig-eks.erb} +0 -0
  71. data/cookbooks/mu-tools/templates/default/kubeconfig-gke.erb +27 -0
  72. data/cookbooks/mu-tools/templates/windows-10/sshd_config.erb +137 -0
  73. data/cookbooks/mu-utility/recipes/nat.rb +4 -0
  74. data/extras/alpha.png +0 -0
  75. data/extras/beta.png +0 -0
  76. data/extras/clean-stock-amis +2 -2
  77. data/extras/generate-stock-images +131 -0
  78. data/extras/git-fix-permissions-hook +0 -0
  79. data/extras/image-generators/AWS/centos6.yaml +17 -0
  80. data/extras/image-generators/{aws → AWS}/centos7-govcloud.yaml +0 -0
  81. data/extras/image-generators/{aws → AWS}/centos7.yaml +0 -0
  82. data/extras/image-generators/{aws → AWS}/rhel7.yaml +0 -0
  83. data/extras/image-generators/{aws → AWS}/win2k12.yaml +0 -0
  84. data/extras/image-generators/{aws → AWS}/win2k16.yaml +0 -0
  85. data/extras/image-generators/{aws → AWS}/windows.yaml +0 -0
  86. data/extras/image-generators/{gcp → Google}/centos6.yaml +1 -0
  87. data/extras/image-generators/Google/centos7.yaml +18 -0
  88. data/extras/python_rpm/build.sh +0 -0
  89. data/extras/release.png +0 -0
  90. data/extras/ruby_rpm/build.sh +0 -0
  91. data/extras/ruby_rpm/muby.spec +1 -1
  92. data/install/README.md +43 -5
  93. data/install/deprecated-bash-library.sh +0 -0
  94. data/install/installer +1 -1
  95. data/install/jenkinskeys.rb +0 -0
  96. data/install/mu-master.yaml +55 -0
  97. data/modules/mommacat.ru +41 -7
  98. data/modules/mu.rb +444 -149
  99. data/modules/mu/adoption.rb +500 -0
  100. data/modules/mu/cleanup.rb +235 -158
  101. data/modules/mu/cloud.rb +675 -138
  102. data/modules/mu/clouds/aws.rb +156 -24
  103. data/modules/mu/clouds/aws/alarm.rb +4 -14
  104. data/modules/mu/clouds/aws/bucket.rb +60 -18
  105. data/modules/mu/clouds/aws/cache_cluster.rb +8 -20
  106. data/modules/mu/clouds/aws/collection.rb +12 -22
  107. data/modules/mu/clouds/aws/container_cluster.rb +209 -118
  108. data/modules/mu/clouds/aws/database.rb +120 -45
  109. data/modules/mu/clouds/aws/dnszone.rb +7 -18
  110. data/modules/mu/clouds/aws/endpoint.rb +5 -15
  111. data/modules/mu/clouds/aws/firewall_rule.rb +144 -72
  112. data/modules/mu/clouds/aws/folder.rb +4 -11
  113. data/modules/mu/clouds/aws/function.rb +6 -16
  114. data/modules/mu/clouds/aws/group.rb +4 -12
  115. data/modules/mu/clouds/aws/habitat.rb +11 -13
  116. data/modules/mu/clouds/aws/loadbalancer.rb +40 -28
  117. data/modules/mu/clouds/aws/log.rb +5 -13
  118. data/modules/mu/clouds/aws/msg_queue.rb +9 -24
  119. data/modules/mu/clouds/aws/nosqldb.rb +4 -12
  120. data/modules/mu/clouds/aws/notifier.rb +6 -13
  121. data/modules/mu/clouds/aws/role.rb +69 -40
  122. data/modules/mu/clouds/aws/search_domain.rb +17 -20
  123. data/modules/mu/clouds/aws/server.rb +184 -94
  124. data/modules/mu/clouds/aws/server_pool.rb +33 -38
  125. data/modules/mu/clouds/aws/storage_pool.rb +5 -12
  126. data/modules/mu/clouds/aws/user.rb +59 -33
  127. data/modules/mu/clouds/aws/userdata/linux.erb +18 -30
  128. data/modules/mu/clouds/aws/userdata/windows.erb +9 -9
  129. data/modules/mu/clouds/aws/vpc.rb +214 -145
  130. data/modules/mu/clouds/azure.rb +978 -44
  131. data/modules/mu/clouds/azure/container_cluster.rb +413 -0
  132. data/modules/mu/clouds/azure/firewall_rule.rb +500 -0
  133. data/modules/mu/clouds/azure/habitat.rb +167 -0
  134. data/modules/mu/clouds/azure/loadbalancer.rb +205 -0
  135. data/modules/mu/clouds/azure/role.rb +211 -0
  136. data/modules/mu/clouds/azure/server.rb +810 -0
  137. data/modules/mu/clouds/azure/user.rb +257 -0
  138. data/modules/mu/clouds/azure/userdata/README.md +4 -0
  139. data/modules/mu/clouds/azure/userdata/linux.erb +137 -0
  140. data/modules/mu/clouds/azure/userdata/windows.erb +275 -0
  141. data/modules/mu/clouds/azure/vpc.rb +782 -0
  142. data/modules/mu/clouds/cloudformation.rb +12 -9
  143. data/modules/mu/clouds/cloudformation/firewall_rule.rb +5 -13
  144. data/modules/mu/clouds/cloudformation/server.rb +10 -1
  145. data/modules/mu/clouds/cloudformation/server_pool.rb +1 -0
  146. data/modules/mu/clouds/cloudformation/vpc.rb +0 -2
  147. data/modules/mu/clouds/google.rb +554 -117
  148. data/modules/mu/clouds/google/bucket.rb +173 -32
  149. data/modules/mu/clouds/google/container_cluster.rb +1112 -157
  150. data/modules/mu/clouds/google/database.rb +24 -47
  151. data/modules/mu/clouds/google/firewall_rule.rb +344 -89
  152. data/modules/mu/clouds/google/folder.rb +156 -79
  153. data/modules/mu/clouds/google/group.rb +272 -82
  154. data/modules/mu/clouds/google/habitat.rb +177 -52
  155. data/modules/mu/clouds/google/loadbalancer.rb +9 -34
  156. data/modules/mu/clouds/google/role.rb +1211 -0
  157. data/modules/mu/clouds/google/server.rb +491 -227
  158. data/modules/mu/clouds/google/server_pool.rb +233 -48
  159. data/modules/mu/clouds/google/user.rb +479 -125
  160. data/modules/mu/clouds/google/userdata/linux.erb +3 -3
  161. data/modules/mu/clouds/google/userdata/windows.erb +9 -9
  162. data/modules/mu/clouds/google/vpc.rb +381 -223
  163. data/modules/mu/config.rb +689 -214
  164. data/modules/mu/config/bucket.rb +1 -1
  165. data/modules/mu/config/cache_cluster.rb +1 -1
  166. data/modules/mu/config/cache_cluster.yml +0 -4
  167. data/modules/mu/config/container_cluster.rb +18 -9
  168. data/modules/mu/config/database.rb +6 -23
  169. data/modules/mu/config/firewall_rule.rb +9 -15
  170. data/modules/mu/config/folder.rb +22 -21
  171. data/modules/mu/config/habitat.rb +22 -21
  172. data/modules/mu/config/loadbalancer.rb +2 -2
  173. data/modules/mu/config/role.rb +9 -40
  174. data/modules/mu/config/server.rb +26 -5
  175. data/modules/mu/config/server_pool.rb +1 -1
  176. data/modules/mu/config/storage_pool.rb +2 -2
  177. data/modules/mu/config/user.rb +4 -0
  178. data/modules/mu/config/vpc.rb +350 -110
  179. data/modules/mu/defaults/{amazon_images.yaml → AWS.yaml} +37 -39
  180. data/modules/mu/defaults/Azure.yaml +17 -0
  181. data/modules/mu/defaults/Google.yaml +24 -0
  182. data/modules/mu/defaults/README.md +1 -1
  183. data/modules/mu/deploy.rb +168 -125
  184. data/modules/mu/groomer.rb +2 -1
  185. data/modules/mu/groomers/ansible.rb +104 -32
  186. data/modules/mu/groomers/chef.rb +96 -44
  187. data/modules/mu/kittens.rb +20602 -0
  188. data/modules/mu/logger.rb +38 -11
  189. data/modules/mu/master.rb +90 -8
  190. data/modules/mu/master/chef.rb +2 -3
  191. data/modules/mu/master/ldap.rb +0 -1
  192. data/modules/mu/master/ssl.rb +250 -0
  193. data/modules/mu/mommacat.rb +917 -513
  194. data/modules/scratchpad.erb +1 -1
  195. data/modules/tests/super_complex_bok.yml +0 -0
  196. data/modules/tests/super_simple_bok.yml +0 -0
  197. data/roles/mu-master.json +2 -1
  198. data/spec/azure_creds +5 -0
  199. data/spec/mu.yaml +56 -0
  200. data/spec/mu/clouds/azure_spec.rb +164 -27
  201. data/spec/spec_helper.rb +5 -0
  202. data/test/clean_up.py +0 -0
  203. data/test/exec_inspec.py +0 -0
  204. data/test/exec_mu_install.py +0 -0
  205. data/test/exec_retry.py +0 -0
  206. data/test/smoke_test.rb +0 -0
  207. metadata +90 -118
  208. data/cookbooks/mu-jenkins/Berksfile +0 -14
  209. data/cookbooks/mu-jenkins/CHANGELOG.md +0 -13
  210. data/cookbooks/mu-jenkins/LICENSE +0 -37
  211. data/cookbooks/mu-jenkins/README.md +0 -105
  212. data/cookbooks/mu-jenkins/attributes/default.rb +0 -42
  213. data/cookbooks/mu-jenkins/files/default/cleanup_deploy_config.xml +0 -73
  214. data/cookbooks/mu-jenkins/files/default/deploy_config.xml +0 -44
  215. data/cookbooks/mu-jenkins/metadata.rb +0 -21
  216. data/cookbooks/mu-jenkins/recipes/default.rb +0 -195
  217. data/cookbooks/mu-jenkins/recipes/node-ssh-config.rb +0 -54
  218. data/cookbooks/mu-jenkins/recipes/public_key.rb +0 -24
  219. data/cookbooks/mu-jenkins/templates/default/example_job.config.xml.erb +0 -24
  220. data/cookbooks/mu-jenkins/templates/default/org.jvnet.hudson.plugins.SSHBuildWrapper.xml.erb +0 -14
  221. data/cookbooks/mu-jenkins/templates/default/ssh_config.erb +0 -6
  222. data/cookbooks/nagios/Berksfile +0 -11
  223. data/cookbooks/nagios/CHANGELOG.md +0 -589
  224. data/cookbooks/nagios/CONTRIBUTING.md +0 -11
  225. data/cookbooks/nagios/LICENSE +0 -37
  226. data/cookbooks/nagios/README.md +0 -328
  227. data/cookbooks/nagios/TESTING.md +0 -2
  228. data/cookbooks/nagios/attributes/config.rb +0 -171
  229. data/cookbooks/nagios/attributes/default.rb +0 -228
  230. data/cookbooks/nagios/chefignore +0 -102
  231. data/cookbooks/nagios/definitions/command.rb +0 -33
  232. data/cookbooks/nagios/definitions/contact.rb +0 -33
  233. data/cookbooks/nagios/definitions/contactgroup.rb +0 -33
  234. data/cookbooks/nagios/definitions/host.rb +0 -33
  235. data/cookbooks/nagios/definitions/hostdependency.rb +0 -33
  236. data/cookbooks/nagios/definitions/hostescalation.rb +0 -34
  237. data/cookbooks/nagios/definitions/hostgroup.rb +0 -33
  238. data/cookbooks/nagios/definitions/nagios_conf.rb +0 -38
  239. data/cookbooks/nagios/definitions/resource.rb +0 -33
  240. data/cookbooks/nagios/definitions/service.rb +0 -33
  241. data/cookbooks/nagios/definitions/servicedependency.rb +0 -33
  242. data/cookbooks/nagios/definitions/serviceescalation.rb +0 -34
  243. data/cookbooks/nagios/definitions/servicegroup.rb +0 -33
  244. data/cookbooks/nagios/definitions/timeperiod.rb +0 -33
  245. data/cookbooks/nagios/libraries/base.rb +0 -314
  246. data/cookbooks/nagios/libraries/command.rb +0 -91
  247. data/cookbooks/nagios/libraries/contact.rb +0 -230
  248. data/cookbooks/nagios/libraries/contactgroup.rb +0 -112
  249. data/cookbooks/nagios/libraries/custom_option.rb +0 -36
  250. data/cookbooks/nagios/libraries/data_bag_helper.rb +0 -23
  251. data/cookbooks/nagios/libraries/default.rb +0 -90
  252. data/cookbooks/nagios/libraries/host.rb +0 -412
  253. data/cookbooks/nagios/libraries/hostdependency.rb +0 -181
  254. data/cookbooks/nagios/libraries/hostescalation.rb +0 -173
  255. data/cookbooks/nagios/libraries/hostgroup.rb +0 -119
  256. data/cookbooks/nagios/libraries/nagios.rb +0 -282
  257. data/cookbooks/nagios/libraries/resource.rb +0 -59
  258. data/cookbooks/nagios/libraries/service.rb +0 -455
  259. data/cookbooks/nagios/libraries/servicedependency.rb +0 -215
  260. data/cookbooks/nagios/libraries/serviceescalation.rb +0 -195
  261. data/cookbooks/nagios/libraries/servicegroup.rb +0 -144
  262. data/cookbooks/nagios/libraries/timeperiod.rb +0 -160
  263. data/cookbooks/nagios/libraries/users_helper.rb +0 -54
  264. data/cookbooks/nagios/metadata.rb +0 -25
  265. data/cookbooks/nagios/recipes/_load_databag_config.rb +0 -153
  266. data/cookbooks/nagios/recipes/_load_default_config.rb +0 -241
  267. data/cookbooks/nagios/recipes/apache.rb +0 -48
  268. data/cookbooks/nagios/recipes/default.rb +0 -204
  269. data/cookbooks/nagios/recipes/nginx.rb +0 -82
  270. data/cookbooks/nagios/recipes/pagerduty.rb +0 -143
  271. data/cookbooks/nagios/recipes/server_package.rb +0 -40
  272. data/cookbooks/nagios/recipes/server_source.rb +0 -164
  273. data/cookbooks/nagios/templates/default/apache2.conf.erb +0 -96
  274. data/cookbooks/nagios/templates/default/cgi.cfg.erb +0 -266
  275. data/cookbooks/nagios/templates/default/commands.cfg.erb +0 -13
  276. data/cookbooks/nagios/templates/default/contacts.cfg.erb +0 -37
  277. data/cookbooks/nagios/templates/default/hostgroups.cfg.erb +0 -25
  278. data/cookbooks/nagios/templates/default/hosts.cfg.erb +0 -15
  279. data/cookbooks/nagios/templates/default/htpasswd.users.erb +0 -6
  280. data/cookbooks/nagios/templates/default/nagios.cfg.erb +0 -22
  281. data/cookbooks/nagios/templates/default/nginx.conf.erb +0 -62
  282. data/cookbooks/nagios/templates/default/pagerduty.cgi.erb +0 -185
  283. data/cookbooks/nagios/templates/default/resource.cfg.erb +0 -27
  284. data/cookbooks/nagios/templates/default/servicedependencies.cfg.erb +0 -15
  285. data/cookbooks/nagios/templates/default/servicegroups.cfg.erb +0 -14
  286. data/cookbooks/nagios/templates/default/services.cfg.erb +0 -14
  287. data/cookbooks/nagios/templates/default/templates.cfg.erb +0 -31
  288. data/cookbooks/nagios/templates/default/timeperiods.cfg.erb +0 -13
  289. data/extras/image-generators/aws/centos6.yaml +0 -18
  290. data/modules/mu/defaults/google_images.yaml +0 -16
  291. data/roles/mu-master-jenkins.json +0 -24
@@ -52,7 +52,7 @@ module MU
52
52
  },
53
53
  "policies" => {
54
54
  "type" => "array",
55
- "items" => MU::Config::Role.policy_primitive(subobjects: true, grant_to: true, permissions_optional: true)
55
+ "items" => MU::Config::Role.policy_primitive(subobjects: true, grant_to: true, permissions_optional: true, targets_optional: true)
56
56
  }
57
57
  }
58
58
  }
@@ -163,7 +163,7 @@ module MU
163
163
  end
164
164
  cluster["multi_az"] = true if cluster["node_count"] > 1
165
165
 
166
- if !cluster['scrub_mu_isms']
166
+ if !cluster['scrub_mu_isms'] and cluster["cloud"] != "Azure"
167
167
  cluster['dependencies'] << configurator.adminFirewallRuleset(vpc: cluster['vpc'], region: cluster['region'], cloud: cluster['cloud'], credentials: cluster['credentials'])
168
168
  end
169
169
 
@@ -1,22 +1,18 @@
1
1
  <% if $complexity == "complex" %>
2
2
  name: redis
3
- credentials: egtprod
4
3
  engine: redis
5
4
  creation_style: new
6
5
  size: cache.t2.medium
7
6
  name: memcache
8
- credentials: egtprod
9
7
  creation_style: new
10
8
  engine: memcached
11
9
  size: cache.t2.medium
12
10
  <% else %>
13
11
  name: redis
14
- credentials: egtprod
15
12
  engine: redis
16
13
  creation_style: new
17
14
  size: cache.t2.medium
18
15
  name: memcache
19
- credentials: egtprod
20
16
  creation_style: new
21
17
  engine: memcached
22
18
  size: cache.t2.medium
@@ -23,8 +23,7 @@ module MU
23
23
  base = {
24
24
  "type" => "object",
25
25
  "description" => "Create a cluster of container hosts.",
26
- "required" => ["name", "cloud", "instance_type", "instance_count"],
27
- "additionalProperties" => false,
26
+ "required" => ["name", "cloud", "instance_type"],
28
27
  "properties" => {
29
28
  "name" => { "type" => "string" },
30
29
  "region" => MU::Config.region_primitive,
@@ -35,18 +34,26 @@ module MU
35
34
  "type" => "integer",
36
35
  "default" => 2
37
36
  },
37
+ "min_size" => {
38
+ "type" => "integer",
39
+ "description" => "Enable worker cluster scaling and set the minimum number of workers to this value. This value is ignored for platforms which abstract scaling activity, such as AWS Fargate."
40
+ },
41
+ "max_size" => {
42
+ "type" => "integer",
43
+ "description" => "Enable worker cluster scaling and set the maximum number of workers to this value. This value is ignored for platforms which abstract scaling activity, such as AWS Fargate."
44
+ },
38
45
  "kubernetes" => {
39
46
  "type" => "object",
40
- "description" => "Options for Kubernetes, specific to EKS or GKE",
47
+ "description" => "Kubernetes-specific options",
41
48
  "properties" => {
42
49
  "version" => {
43
50
  "type" => "string",
44
- "default" => "1.11",
51
+ "default" => "1.13",
45
52
  "description" => "Version of Kubernetes control plane to deploy",
46
53
  },
47
54
  "max_pods" => {
48
55
  "type" => "integer",
49
- "default" => 5,
56
+ "default" => 30,
50
57
  "description" => "Maximum number of pods that can be deployed on any given worker node",
51
58
  }
52
59
  }
@@ -58,10 +65,6 @@ module MU
58
65
  "description" => "Optional Kubernetes-specific resource descriptors to run with kubectl create|replace when grooming this cluster. See https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/#understanding-kubernetes-objects"
59
66
  }
60
67
  },
61
- "flavor" => {
62
- "type" => "string",
63
- "description" => "Container clusters in Amazon can be ECS, EKS, or Fargate; Google supports GKE only"
64
- },
65
68
  "platform" => {
66
69
  "type" => "string",
67
70
  "default" => "linux",
@@ -95,6 +98,12 @@ module MU
95
98
  # @return [Boolean]: True if validation succeeded, False otherwise
96
99
  def self.validate(cluster, configurator)
97
100
  ok = true
101
+
102
+ if cluster["max_size"] or cluster["min_size"]
103
+ cluster["max_size"] ||= [cluster["instance_count"], cluster["min_size"]].reject { |c| c.nil? }.max
104
+ cluster["min_size"] ||= [cluster["instance_count"], cluster["min_size"]].reject { |c| c.nil? }.min
105
+ end
106
+
98
107
  ok
99
108
  end
100
109
 
@@ -42,13 +42,13 @@ module MU
42
42
  "tags" => MU::Config.tags_primitive,
43
43
  "optional_tags" => MU::Config.optional_tags_primitive,
44
44
  "alarms" => MU::Config::Alarm.inline,
45
- "engine_version" => {"type" => "string"},
46
45
  "add_firewall_rules" => MU::Config::FirewallRule.reference,
47
46
  "read_replica_of" => reference,
48
47
  "ingress_rules" => {
49
48
  "type" => "array",
50
49
  "items" => MU::Config::FirewallRule.ruleschema
51
50
  },
51
+ "engine_version" => {"type" => "string"},
52
52
  "engine" => {
53
53
  "enum" => ["mysql", "postgres", "oracle-se1", "oracle-se2", "oracle-se", "oracle-ee", "sqlserver-ee", "sqlserver-se", "sqlserver-ex", "sqlserver-web", "aurora", "mariadb"],
54
54
  "type" => "string"
@@ -169,13 +169,7 @@ module MU
169
169
  "cluster_node_count" => {
170
170
  "type" => "integer",
171
171
  "description" => "The number of database instances to add to a database cluster. This only applies to aurora",
172
- "default_if" => [
173
- {
174
- "key_is" => "engine",
175
- "value_is" => "aurora",
176
- "set" => 1
177
- }
178
- ]
172
+ "default" => 2
179
173
  },
180
174
  "create_cluster" => {
181
175
  "type" => "boolean",
@@ -188,17 +182,6 @@ module MU
188
182
  }
189
183
  ]
190
184
  },
191
- "parameter_group_family" => {
192
- "type" => "String",
193
- "enum" => [
194
- "postgres9.6", "postgres9.5", "postgres9.4", "postgres9.3",
195
- "mysql5.1", "mysql5.5", "mysql5.6", "mysql5.7",
196
- "oracle-ee-11.2", "oracle-ee-12.1", "oracle-se-11.2", "oracle-se-12.1", "oracle-se1-11.2", "oracle-se1-12.1",
197
- "sqlserver-ee-10.5", "sqlserver-ee-11.0", "sqlserver-ee-12.0", "sqlserver-ex-10.5", "sqlserver-ex-11.0", "sqlserver-ex-12.0", "sqlserver-se-10.5", "sqlserver-se-11.0", "sqlserver-se-12.0", "sqlserver-web-10.5", "sqlserver-web-11.0", "sqlserver-web-12.0",
198
- "aurora5.6", "mariadb-10.0", "mariadb-10.1"
199
- ],
200
- "description" => "The database family to create the DB Parameter Group for. The family type must be the same type as the database major version - eg if you set engine_version to 9.4.4 the db_family must be set to postgres9.4."
201
- },
202
185
  "auth_vault" => {
203
186
  "type" => "object",
204
187
  "additionalProperties" => false,
@@ -327,9 +310,9 @@ module MU
327
310
 
328
311
  if !db["vpc"].nil?
329
312
  if db["vpc"]["subnet_pref"] and !db["vpc"]["subnets"]
330
- if db["vpc"]["subnet_pref"] = "public"
313
+ if db["vpc"]["subnet_pref"] == "public"
331
314
  db["vpc"]["subnet_pref"] = "all_public"
332
- elsif db["vpc"]["subnet_pref"] = "private"
315
+ elsif db["vpc"]["subnet_pref"] == "private"
333
316
  db["vpc"]["subnet_pref"] = "all_private"
334
317
  elsif %w{all any}.include? db["vpc"]["subnet_pref"]
335
318
  MU.log "subnet_pref #{db["vpc"]["subnet_pref"]} is not supported for database instance.", MU::ERR
@@ -452,8 +435,8 @@ module MU
452
435
  end
453
436
  db['dependencies'].uniq!
454
437
 
455
- read_replicas.each { |replica|
456
- ok = false if !configurator.insertKitten(replica, "databases")
438
+ read_replicas.each { |new_replica|
439
+ ok = false if !configurator.insertKitten(new_replica, "databases")
457
440
  }
458
441
  cluster_nodes.each { |member|
459
442
  ok = false if !configurator.insertKitten(member, "databases")
@@ -48,8 +48,8 @@ module MU
48
48
  "default" => false
49
49
  },
50
50
  "rules" => {
51
- "type" => "array",
52
- "items" => ruleschema
51
+ "type" => "array",
52
+ "items" => ruleschema
53
53
  }
54
54
  }
55
55
  }
@@ -61,7 +61,7 @@ module MU
61
61
  {
62
62
  "type" => "object",
63
63
  "description" => "Network ingress and/or egress rules.",
64
- "additionalProperties" => false,
64
+ # "additionalProperties" => false, # inline ingress_rules can have cloud-specific attributes, and this trips those up
65
65
  "properties" => {
66
66
  "port_range" => {"type" => "string"},
67
67
  "port" => {"type" => "integer"},
@@ -71,8 +71,7 @@ module MU
71
71
  "type" => "string"
72
72
  },
73
73
  "ingress" => {
74
- "type" => "boolean",
75
- "default" => true
74
+ "type" => "boolean"
76
75
  },
77
76
  "egress" => {
78
77
  "type" => "boolean",
@@ -93,18 +92,13 @@ module MU
93
92
  # Schema block for other resources to use when referencing a sibling FirewallRule
94
93
  # @return [Hash]
95
94
  def self.reference
95
+ schema_aliases = [
96
+ { "rule_id" => "id" },
97
+ { "rule_name" => "name" }
98
+ ]
96
99
  {
97
100
  "type" => "array",
98
- "items" => {
99
- "type" => "object",
100
- "additionalProperties" => false,
101
- "description" => "Apply one or more network rulesets, defined in this stack or pre-existing, to this resource. Note that if you add a pre-existing ACL to your resource, they must be compatible (e.g. if using VPCs, they must reside in the same VPC).",
102
- "minProperties" => 1,
103
- "properties" => {
104
- "rule_id" => {"type" => "string"},
105
- "rule_name" => {"type" => "string"}
106
- }
107
- }
101
+ "items" => MU::Config::Ref.schema(schema_aliases, type: "firewall_rules")
108
102
  }
109
103
  end
110
104
 
@@ -34,27 +34,28 @@ module MU
34
34
  # Chunk of schema to reference a folder/OU, here to be embedded
35
35
  # into the schemas of other resources.
36
36
  def self.reference
37
- {
38
- "type" => "object",
39
- "description" => "Deploy into or connect with resources in a specific account/project",
40
- "minProperties" => 1,
41
- "additionalProperties" => false,
42
- "properties" => {
43
- "id" => {
44
- "type" => "string",
45
- "description" => "Discover this folder/OU by looking by its cloud provider identifier "
46
- },
47
- "name" => {
48
- "type" => "string",
49
- "description" => "Discover this folder/OU by Mu-internal name; typically the shorthand 'name' field of an Folder object declared elsewhere in the deploy, or in another deploy that's being referenced with 'deploy_id'."
50
- },
51
- "cloud" => MU::Config.cloud_primitive,
52
- "deploy_id" => {
53
- "type" => "string",
54
- "description" => "Search for this folder in an existing Mu deploy; specify a Mu deploy id (e.g. DEMO-DEV-2014111400-NG)."
55
- }
56
- }
57
- }
37
+ # {
38
+ # "type" => "object",
39
+ # "description" => "Deploy into or connect with resources in a specific account/project",
40
+ # "minProperties" => 1,
41
+ # "additionalProperties" => false,
42
+ # "properties" => {
43
+ # "id" => {
44
+ # "type" => "string",
45
+ # "description" => "Discover this folder/OU by looking by its cloud provider identifier "
46
+ # },
47
+ # "name" => {
48
+ # "type" => "string",
49
+ # "description" => "Discover this folder/OU by Mu-internal name; typically the shorthand 'name' field of an Folder object declared elsewhere in the deploy, or in another deploy that's being referenced with 'deploy_id'."
50
+ # },
51
+ # "cloud" => MU::Config.cloud_primitive,
52
+ # "deploy_id" => {
53
+ # "type" => "string",
54
+ # "description" => "Search for this folder in an existing Mu deploy; specify a Mu deploy id (e.g. DEMO-DEV-2014111400-NG)."
55
+ # }
56
+ # }
57
+ # }
58
+ MU::Config::Ref.schema(type: "folders")
58
59
  end
59
60
 
60
61
  # Generic pre-processing of {MU::Config::BasketofKittens::folder}, bare and unvalidated.
@@ -34,27 +34,28 @@ module MU
34
34
  # Chunk of schema to reference an account/project, here to be embedded
35
35
  # into the schemas of other resources.
36
36
  def self.reference
37
- {
38
- "type" => "object",
39
- "description" => "Deploy into or connect with resources in a specific habitat (AWS account, GCP project, etc)",
40
- "minProperties" => 1,
41
- "additionalProperties" => false,
42
- "properties" => {
43
- "id" => {
44
- "type" => "string",
45
- "description" => "Discover this habitat by looking for this cloud provider identifier, such as 836541910896 (an AWS account number) or my-project-196124 (a Google Cloud project id)"
46
- },
47
- "name" => {
48
- "type" => "string",
49
- "description" => "Discover this habitat by Mu-internal name; typically the shorthand 'name' field of a Habitat object declared elsewhere in the deploy, or in another deploy that's being referenced with 'deploy_id'."
50
- },
51
- "cloud" => MU::Config.cloud_primitive,
52
- "deploy_id" => {
53
- "type" => "string",
54
- "description" => "Search for this Habitat in an existing Mu deploy by Mu deploy id (e.g. DEMO-DEV-2014111400-NG)."
55
- }
56
- }
57
- }
37
+ # {
38
+ # "type" => "object",
39
+ # "description" => "Deploy into or connect with resources in a specific habitat (AWS account, GCP project, etc)",
40
+ # "minProperties" => 1,
41
+ # "additionalProperties" => false,
42
+ # "properties" => {
43
+ # "id" => {
44
+ # "type" => "string",
45
+ # "description" => "Discover this habitat by looking for this cloud provider identifier, such as 836541910896 (an AWS account number) or my-project-196124 (a Google Cloud project id)"
46
+ # },
47
+ # "name" => {
48
+ # "type" => "string",
49
+ # "description" => "Discover this habitat by Mu-internal name; typically the shorthand 'name' field of a Habitat object declared elsewhere in the deploy, or in another deploy that's being referenced with 'deploy_id'."
50
+ # },
51
+ # "cloud" => MU::Config.cloud_primitive,
52
+ # "deploy_id" => {
53
+ # "type" => "string",
54
+ # "description" => "Search for this Habitat in an existing Mu deploy by Mu deploy id (e.g. DEMO-DEV-2014111400-NG)."
55
+ # }
56
+ # }
57
+ # }
58
+ MU::Config::Ref.schema(type: "habitats")
58
59
  end
59
60
 
60
61
  # Generic pre-processing of {MU::Config::BasketofKittens::habitat}, bare and unvalidated.
@@ -103,8 +103,8 @@ module MU
103
103
  },
104
104
  "alarms" => MU::Config::Alarm.inline,
105
105
  "ingress_rules" => {
106
- "type" => "array",
107
- "items" => MU::Config::FirewallRule.ruleschema
106
+ "type" => "array",
107
+ "items" => MU::Config::FirewallRule.ruleschema
108
108
  },
109
109
  "region" => MU::Config.region_primitive,
110
110
  "cross_zone_unstickiness" => {
@@ -48,27 +48,7 @@ module MU
48
48
  # Chunk of schema to reference an account/project, here to be embedded
49
49
  # into the schemas of other resources.
50
50
  def self.reference
51
- {
52
- "type" => "object",
53
- "description" => "An IAM role to associate with this resource",
54
- "minProperties" => 1,
55
- "additionalProperties" => false,
56
- "properties" => {
57
- "id" => {
58
- "type" => "string",
59
- "description" => "Discover this role by looking for this cloud provider identifier, such as an AWS ARN"
60
- },
61
- "name" => {
62
- "type" => "string",
63
- "description" => "Discover this role by Mu-internal name; typically the shorthand 'name' field of a Role object declared elsewhere in the deploy, or in another deploy that's being referenced with 'deploy_id'."
64
- },
65
- "cloud" => MU::Config.cloud_primitive,
66
- "deploy_id" => {
67
- "type" => "string",
68
- "description" => "Search for this Role in an existing Mu deploy by Mu deploy id (e.g. DEMO-DEV-2014111400-NG)."
69
- }
70
- }
71
- }
51
+ MU::Config::Ref.schema(type: "roles")
72
52
  end
73
53
 
74
54
  # A generic, cloud-neutral descriptor for a policy that grants or denies
@@ -76,11 +56,11 @@ module MU
76
56
  # @param subobjects [Boolean]: Whether the returned schema should include a +path+ parameter
77
57
  # @param grant_to [Boolean]: Whether the returned schema should include an explicit +grant_to+ parameter
78
58
  # @return [Hash]
79
- def self.policy_primitive(subobjects: false, grant_to: false, permissions_optional: false)
59
+ def self.policy_primitive(subobjects: false, grant_to: false, permissions_optional: false, targets_optional: false)
80
60
  cfg = {
81
61
  "type" => "object",
82
62
  "description" => "Policies which grant or deny permissions.",
83
- "required" => ["name", "targets"],
63
+ "required" => ["name"],
84
64
  # "additionalProperties" => false,
85
65
  "properties" => {
86
66
  "name" => {
@@ -126,28 +106,17 @@ module MU
126
106
  }
127
107
 
128
108
  cfg["required"] << "permissions" if !permissions_optional
109
+ cfg["required"] << "targets" if !targets_optional
110
+
111
+ schema_aliases = [
112
+ { "identifier" => "id" },
113
+ ]
129
114
 
130
115
  if grant_to
131
116
  cfg["properties"]["grant_to"] = {
132
117
  "type" => "array",
133
118
  "default" => [ { "identifier" => "*" } ],
134
- "items" => {
135
- "type" => "object",
136
- "description" => "Entities to which this policy will grant or deny access.",
137
- "required" => ["identifier"],
138
- "additionalProperties" => false,
139
- "properties" => {
140
- "type" => {
141
- "type" => "string",
142
- "description" => "A Mu resource type, used when referencing a sibling Mu resource in this stack with +identifier+.",
143
- "enum" => MU::Cloud.resource_types.values.map { |t| t[:cfg_name] }.sort
144
- },
145
- "identifier" => {
146
- "type" => "string",
147
- "description" => "Either the name of a sibling Mu resource in this stack (used in conjunction with +entity_type+), or the full cloud identifier for a resource, such as an Amazon ARN or email-address-formatted Google Cloud username. Wildcards (+*+) are valid if supported by the cloud provider."
148
- }
149
- }
150
- }
119
+ "items" => MU::Config::Ref.schema(schema_aliases, desc: "Entities to which this policy will grant or deny access.")
151
120
  }
152
121
  end
153
122
 
@@ -120,6 +120,10 @@ module MU
120
120
  def self.common_properties
121
121
  {
122
122
  "name" => {"type" => "string"},
123
+ "ansible_vars" => {
124
+ "type" => "object",
125
+ "description" => "When using Ansible as a groomer, this will insert a +vars+ tree into the playbook for this node."
126
+ },
123
127
  "scrub_mu_isms" => {
124
128
  "type" => "boolean",
125
129
  "default" => false,
@@ -412,9 +416,8 @@ module MU
412
416
  "platform" => {
413
417
  "type" => "string",
414
418
  "default" => "linux",
415
- "enum" => ["linux", "windows", "centos", "ubuntu", "centos6", "ubuntu14", "win2k12", "win2k12r2", "win2k16", "centos7", "rhel7", "rhel71", "amazon"],
416
- # XXX change to reflect available keys in mu/defaults/amazon_images.yaml and mu/defaults/google_images.yaml
417
- "description" => "Helps select default AMIs, and enables correct grooming behavior based on operating system type.",
419
+ "enum" => MU::Cloud.listPlatforms,
420
+ "description" => "Helps select default machine images, and enables correct grooming behavior based on operating system type.",
418
421
  },
419
422
  "run_list" => {
420
423
  "type" => "array",
@@ -500,11 +503,19 @@ module MU
500
503
  "description" => "Create individual server instances.",
501
504
  "properties" => {
502
505
  "dns_records" => MU::Config::DNSZone.records_primitive(need_target: false, default_type: "A", need_zone: true),
506
+ "bastion" => {
507
+ "type" => "boolean",
508
+ "default" => false,
509
+ "description" => "Allow this server to be automatically used as a bastion host"
510
+ },
511
+ "image_id" => {
512
+ "type" => "string",
513
+ "description" => "The cloud provider image on which to base this instance. Will use the default appropriate for the +platform+, if not specified."
514
+ },
503
515
  "create_image" => {
504
516
  "type" => "object",
505
517
  "title" => "create_image",
506
518
  "required" => ["image_then_destroy", "image_exclude_storage", "public"],
507
- "additionalProperties" => false,
508
519
  "description" => "Create a reusable image of this server once it is complete.",
509
520
  "properties" => {
510
521
  "public" => {
@@ -570,7 +581,7 @@ module MU
570
581
  server['vault_access'] << {"vault" => "splunk", "item" => "admin_user"}
571
582
  ok = false if !MU::Config.check_vault_refs(server)
572
583
 
573
- if !server['scrub_mu_isms']
584
+ if server["cloud"] != "Azure"
574
585
  server['dependencies'] << configurator.adminFirewallRuleset(vpc: server['vpc'], region: server['region'], cloud: server['cloud'], credentials: server['credentials'])
575
586
  end
576
587
 
@@ -593,6 +604,16 @@ module MU
593
604
  "name" => configurator.nat_routes[server["vpc"]["subnet_name"]],
594
605
  "phase" => "groom"
595
606
  }
607
+ elsif !server["vpc"]["name"].nil?
608
+ siblingvpc = configurator.haveLitterMate?(server["vpc"]["name"], "vpcs")
609
+ if siblingvpc and siblingvpc['bastion'] and
610
+ server['name'] != siblingvpc['bastion'].to_h['name']
611
+ server["dependencies"] << {
612
+ "type" => "server",
613
+ "name" => siblingvpc['bastion'].to_h['name'],
614
+ "phase" => "groom"
615
+ }
616
+ end
596
617
  end
597
618
  end
598
619