staypuft 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +8 -8
  2. data/app/assets/javascripts/staypuft/staypuft.js +99 -1
  3. data/app/assets/stylesheets/staypuft/bootstrap_and_overrides.css.scss +48 -4
  4. data/app/assets/stylesheets/staypuft/staypuft.css.scss +7 -11
  5. data/app/controllers/staypuft/deployments_controller.rb +23 -20
  6. data/app/controllers/staypuft/steps_controller.rb +18 -24
  7. data/app/helpers/staypuft/application_helper.rb +16 -1
  8. data/app/helpers/staypuft/deployments_helper.rb +1 -1
  9. data/app/lib/actions/staypuft/host/wait_until_host_ready.rb +2 -8
  10. data/app/lib/staypuft/seeder.rb +702 -0
  11. data/app/models/staypuft/concerns/host_open_stack_affiliation.rb +29 -2
  12. data/app/models/staypuft/concerns/hostgroup_extensions.rb +28 -3
  13. data/app/models/staypuft/concerns/lookup_key_extensions.rb +72 -0
  14. data/app/models/staypuft/deployment/abstract_param_scope.rb +31 -0
  15. data/app/models/staypuft/deployment/attribute_param_storage.rb +41 -0
  16. data/app/models/staypuft/deployment/cinder_service.rb +87 -0
  17. data/app/models/staypuft/deployment/glance_service.rb +85 -0
  18. data/app/models/staypuft/deployment/ips.rb +26 -0
  19. data/app/models/staypuft/deployment/neutron_service.rb +165 -0
  20. data/app/models/staypuft/deployment/nova_service.rb +84 -0
  21. data/app/models/staypuft/deployment/passwords.rb +66 -0
  22. data/app/models/staypuft/deployment/vips.rb +36 -0
  23. data/app/models/staypuft/deployment.rb +179 -72
  24. data/app/models/staypuft/deployment_role_hostgroup.rb +1 -1
  25. data/app/models/staypuft/role.rb +8 -1
  26. data/app/models/staypuft/service/ui_params.rb +12 -1
  27. data/app/views/staypuft/deployments/_assigned_hosts_table.html.erb +60 -0
  28. data/app/views/staypuft/deployments/_deployed_hosts_table.html.erb +51 -0
  29. data/app/views/staypuft/deployments/_free_hosts_table.html.erb +47 -0
  30. data/app/views/staypuft/deployments/edit.html.erb +50 -0
  31. data/app/views/staypuft/deployments/show.html.erb +41 -79
  32. data/app/views/staypuft/deployments/summary.html.erb +4 -1
  33. data/app/views/staypuft/steps/_cinder.html.erb +17 -0
  34. data/app/views/staypuft/steps/_glance.html.erb +16 -0
  35. data/app/views/staypuft/steps/_neutron.html.erb +57 -0
  36. data/app/views/staypuft/steps/_nova.html.erb +34 -0
  37. data/app/views/staypuft/steps/deployment_settings.html.erb +41 -17
  38. data/app/views/staypuft/steps/services_configuration.html.erb +19 -32
  39. data/app/views/staypuft/steps/{services_selection.html.erb → services_overview.html.erb} +7 -3
  40. data/config/routes.rb +2 -0
  41. data/db/migrate/20140623142500_remove_amqp_provider_from_staypuft_deployment.rb +6 -0
  42. data/db/seeds.rb +1 -314
  43. data/lib/staypuft/engine.rb +1 -0
  44. data/lib/staypuft/version.rb +1 -1
  45. metadata +23 -3
@@ -0,0 +1,702 @@
1
+ require 'facter'
2
+
3
+ module Staypuft
4
+ class Seeder
5
+
6
+ # FIXME: this is the list pulled as-is from astapor. Any changes for staypuft are not
7
+ # yet in place. In addition, I don't know if we want to break these down by
8
+ # Role, or leave them in one big list (internally they get set per puppetclass)
9
+ ASTAPOR_PARAMS = {
10
+ 'verbose' => 'true',
11
+ 'heat_cfn' => 'false',
12
+ 'heat_cloudwatch' => 'false',
13
+ 'ceilometer' => 'true',
14
+ 'ceilometer_host' => 'false',
15
+ 'glance_gluster_peers' => [],
16
+ 'glance_gluster_volume' => 'glance',
17
+ 'glance_gluster_replica_count' => '3',
18
+ 'gluster_open_port_count' => '10',
19
+ 'nova_default_floating_pool' => 'nova',
20
+ 'swift_all_ips' => %w(192.168.203.1 192.168.203.2 192.168.203.3 192.168.203.4),
21
+ 'swift_ext4_device' => '/dev/sdc2',
22
+ 'swift_local_interface' => 'eth3',
23
+ 'swift_loopback' => true,
24
+ 'swift_ring_server' => '192.168.203.1',
25
+ 'controller_admin_host' => '172.16.0.1',
26
+ 'controller_priv_host' => '172.16.0.1',
27
+ 'controller_pub_host' => '172.16.1.1',
28
+ 'mysql_host' => '172.16.0.1',
29
+ 'mysql_virtual_ip' => '192.168.200.220',
30
+ 'mysql_bind_address' => '0.0.0.0',
31
+ 'mysql_virt_ip_nic' => 'eth1',
32
+ 'mysql_virt_ip_cidr_mask' => '24',
33
+ 'mysql_shared_storage_device' => '192.168.203.200:/mnt/mysql',
34
+ 'mysql_shared_storage_type' => 'nfs',
35
+ 'mysql_resource_group_name' => 'mysqlgrp',
36
+ 'mysql_clu_member_addrs' => '192.168.203.11 192.168.203.12 192.168.203.13',
37
+ 'amqp_host' => '172.16.0.1',
38
+ 'amqp_username' => 'openstack',
39
+ 'admin_email' => "admin@#{Facter.value(:domain)}",
40
+ 'enable_ovs_agent' => 'true',
41
+ 'tenant_network_type' => 'vxlan',
42
+ 'ovs_vxlan_udp_port' => '4789',
43
+ 'auto_assign_floating_ip' => 'true',
44
+ 'cisco_vswitch_plugin' => 'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2',
45
+ 'cisco_nexus_plugin' => 'neutron.plugins.cisco.nexus.cisco_nexus_plugin_v2.NexusPlugin',
46
+ 'nexus_config' => {},
47
+ 'nexus_credentials' => [],
48
+ 'provider_vlan_auto_create' => 'false',
49
+ 'provider_vlan_auto_trunk' => 'false',
50
+ 'backend_server_names' => [],
51
+ 'backend_server_addrs' => [],
52
+ 'lb_backend_server_names' => [],
53
+ 'lb_backend_server_addrs' => [],
54
+ 'configure_ovswitch' => 'true',
55
+ 'neutron' => 'false',
56
+ 'ssl' => 'false',
57
+ 'freeipa' => 'false',
58
+ 'mysql_ca' => '/etc/ipa/ca.crt',
59
+ 'mysql_cert' => '/etc/pki/tls/certs/PRIV_HOST-mysql.crt',
60
+ 'mysql_key' => '/etc/pki/tls/private/PRIV_HOST-mysql.key',
61
+ 'amqp_ca' => '/etc/ipa/ca.crt',
62
+ 'amqp_cert' => '/etc/pki/tls/certs/PRIV_HOST-amqp.crt',
63
+ 'amqp_key' => '/etc/pki/tls/private/PRIV_HOST-amqp.key',
64
+ 'horizon_ca' => '/etc/ipa/ca.crt',
65
+ 'horizon_cert' => '/etc/pki/tls/certs/PUB_HOST-horizon.crt',
66
+ 'horizon_key' => '/etc/pki/tls/private/PUB_HOST-horizon.key',
67
+ 'use_qemu_for_poc' => 'false',
68
+ }
69
+
70
+ # key (:ha, etc) is only used internally for referencing from roles
71
+ LAYOUTS = { :ha_nova => { :name => 'High Availability Controllers / Compute',
72
+ :networking => 'nova' },
73
+ :non_ha_nova => { :name => 'Controller / Compute',
74
+ :networking => 'nova' },
75
+ :ha_neutron => { :name => 'High Availability Controllers / Compute',
76
+ :networking => 'neutron' },
77
+ :non_ha_neutron => { :name => 'Controller / Compute',
78
+ :networking => 'neutron' } }
79
+
80
+ # some services don't have puppetclasses yet, since they aren't broken out on the back end
81
+ SERVICES = {
82
+ :non_ha_amqp => { :name => 'AMQP (non-HA)', :class => [] },
83
+ :mysql => { :name => 'MySQL', :class => [] },
84
+ :non_ha_keystone => { :name => 'Keystone (non-HA)', :class => [] },
85
+ :nova_controller => { :name => 'Nova (Controller)', :class => [] },
86
+ :neutron_controller => { :name => 'Neutron (Controller)', :class => [] },
87
+ :non_ha_glance => { :name => 'Glance (non-HA)', :class => [] },
88
+ :cinder_controller => { :name => 'Cinder (controller)', :class => [] },
89
+ :cinder_node => { :name => 'Cinder (node)', :class => ['quickstack::storage_backend::cinder'] },
90
+ :heat => { :name => 'Heat', :class => [] },
91
+ :ceilometer => { :name => 'Ceilometer', :class => [] },
92
+ :neutron_networker => { :name => 'Neutron Networker', :class => ['quickstack::neutron::networker'] },
93
+ :nova_compute => { :name => 'Nova-compute', :class => ['quickstack::nova_network::compute'] },
94
+ :neutron_compute => { :name => 'Neutron-compute', :class => ['quickstack::neutron::compute'] },
95
+ :swift => { :name => 'Swift (node)', :class => ['quickstack::swift::storage'] },
96
+ :ha_controller => { :name => 'HA (Controller)',
97
+ :class => ['quickstack::openstack_common',
98
+ 'quickstack::pacemaker::common',
99
+ 'quickstack::pacemaker::params'] },
100
+ :keystone_ha => { :name => 'Keystone (HA)',
101
+ :class => ['quickstack::pacemaker::keystone'] },
102
+ :load_balancer_ha => { :name => 'Load Balancer (HA)',
103
+ :class => ['quickstack::pacemaker::load_balancer'] },
104
+ :memcached_ha => { :name => 'Memcached (HA)',
105
+ :class => ['quickstack::pacemaker::memcached'] },
106
+ :qpid_ha => { :name => 'qpid (HA)', :class => ['quickstack::pacemaker::qpid'] },
107
+ :glance_ha => { :name => 'Glance (HA)', :class => ['quickstack::pacemaker::glance'] },
108
+ :nova_ha => { :name => 'Nova (HA)', :class => ['quickstack::pacemaker::nova'] },
109
+ :heat_ha => { :name => 'Heat (HA)', :class => ['quickstack::pacemaker::heat'] },
110
+ :cinder_ha => { :name => 'Cinder (HA)', :class => ['quickstack::pacemaker::cinder'] },
111
+ :swift_ha => { :name => 'Swift (HA)', :class => ['quickstack::pacemaker::swift'] },
112
+ :horizon_ha => { :name => 'Horizon (HA)', :class => ['quickstack::pacemaker::horizon'] },
113
+ :galera_ha => { :name => 'Galera (HA)', :class => ['quickstack::pacemaker::galera'] },
114
+ :mysql_ha => { :name => 'Mysql (HA)', :class => ['quickstack::pacemaker::mysql'] },
115
+ :neutron_ha => { :name => 'Neutron (HA)', :class => ['quickstack::pacemaker::neutron'] }
116
+ }
117
+
118
+ # The list of roles is still from astapor
119
+ # FIXME for now layouts are different based on Nova vs. Neutron networks. This is
120
+ # actually incorrect, but it's a placeholder example of how layouts might differ
121
+ # until we get the real list of roles per layout
122
+ # layout refs below specify layout keys from layouts hash
123
+ ROLES = [
124
+ { :name => 'Controller (Nova)',
125
+ :class => 'quickstack::nova_network::controller',
126
+ :layouts => [[:non_ha_nova, 1]],
127
+ :services => [:non_ha_amqp, :mysql, :non_ha_keystone, :nova_controller, :non_ha_glance,
128
+ :cinder_controller, :heat, :ceilometer] },
129
+ { :name => 'Compute (Nova)',
130
+ :class => [],
131
+ :layouts => [[:ha_nova, 10], [:non_ha_nova, 10]],
132
+ :services => [:nova_compute] },
133
+ { :name => 'Controller (Neutron)',
134
+ :class => 'quickstack::neutron::controller',
135
+ :layouts => [[:non_ha_neutron, 1]],
136
+ :services => [:non_ha_amqp, :mysql, :non_ha_keystone, :neutron_controller, :non_ha_glance,
137
+ :cinder_controller, :heat, :ceilometer] },
138
+ { :name => 'Compute (Neutron)',
139
+ :class => [],
140
+ :layouts => [[:ha_neutron, 10], [:non_ha_neutron, 10]],
141
+ :services => [:neutron_compute] },
142
+ { :name => 'Neutron Networker',
143
+ :class => [],
144
+ :layouts => [[:non_ha_neutron, 3]],
145
+ :services => [:neutron_networker] },
146
+ { :name => 'Cinder Block Storage',
147
+ :class => [],
148
+ :layouts => [],
149
+ :services => [:cinder_node] },
150
+ { :name => 'Swift Storage Node',
151
+ :class => [],
152
+ :layouts => [],
153
+ :services => [:swift] },
154
+ { :name => 'HA Controller',
155
+ :class => [],
156
+ :layouts => [[:ha_nova, 1], [:ha_neutron, 1]],
157
+ :services => [:ha_controller, :keystone_ha, :load_balancer_ha, :memcached_ha, :qpid_ha,
158
+ :glance_ha, :nova_ha, :heat_ha, :cinder_ha, :swift_ha, :horizon_ha, :mysql_ha,
159
+ :neutron_ha, :galera_ha] }]
160
+
161
+ CONTROLLER_ROLES = ROLES.select { |h| h.fetch(:name) =~ /Controller/ }
162
+
163
+
164
+ def functional_dependencies
165
+ amqp_provider = '<%= @host.deployment.amqp_provider %>'
166
+ neutron = '<%= @host.deployment.networking == Staypuft::Deployment::Networking::NEUTRON %>'
167
+
168
+ # Nova
169
+ network_manager = '<%= @host.deployment.nova.network_manager %>'
170
+ # multi_host handled inline, since it's two separate static values 'true' and 'True'
171
+ network_overrides = '<%= @host.deployment.nova.network_overrides.to_yaml %>'
172
+ # TODO: determine whether num_networks and network_size are static or calculated
173
+ network_num_networks = 1
174
+ network_network_size = 255
175
+ network_fixed_range = '<%= @host.deployment.nova.private_fixed_range %>'
176
+ network_floating_range = '<%= @host.deployment.nova.public_floating_range %>'
177
+ network_private_iface = '<%= @host.deployment.nova.compute_tenant_interface %>'
178
+ network_public_iface = '<%= @host.deployment.nova.external_interface_name %>'
179
+ network_create_networks = true
180
+
181
+ # Neutron
182
+ ovs_vlan_ranges = '<%= "physnet-tenants:#{@host.deployment.neutron.tenant_vlan_ranges}" %>'
183
+ ml2_network_vlan_ranges = [ovs_vlan_ranges]
184
+ ml2_tenant_network_types = '<%= @host.deployment.neutron.network_segmentation_list %>'
185
+ ml2_tunnel_id_ranges = ['10:100000']
186
+ ml2_vni_ranges = ['10:100000']
187
+ ovs_tunnel_types = ['vxlan', 'gre']
188
+ ovs_tunnel_iface = '<%= @host.deployment.neutron.networker_tenant_interface %>'
189
+ ovs_bridge_mappings = '<%= @host.deployment.neutron.controller_ovs_bridge_mappings %>'
190
+ ovs_bridge_uplinks = '<%= @host.deployment.neutron.controller_ovs_bridge_uplinks %>'
191
+ compute_ovs_tunnel_iface = '<%= @host.deployment.neutron.compute_tenant_interface %>'
192
+ compute_ovs_bridge_mappings = '<%= @host.deployment.neutron.compute_ovs_bridge_mappings %>'
193
+ compute_ovs_bridge_uplinks = '<%= @host.deployment.neutron.compute_ovs_bridge_uplinks %>'
194
+ enable_tunneling = 'true'
195
+
196
+ # Glance
197
+ backend = 'file'
198
+ pcmk_fs_type = '<%= @host.deployment.glance.driver_backend %>'
199
+ pcmk_fs_device = '<%= @host.deployment.glance.pcmk_fs_device %>'
200
+ pcmk_fs_dir = '<%= @host.deployment.glance.pcmk_fs_dir %>'
201
+ pcmk_fs_manage = 'true'
202
+ pcmk_fs_options = '<%= @host.deployment.glance.pcmk_fs_options %>'
203
+
204
+ # Cinder
205
+ volume = true
206
+ cinder_backend_iscsi = '<%= @host.deployment.cinder.lvm_backend? %>'
207
+ cinder_backend_nfs = '<%= @host.deployment.cinder.nfs_backend? %>'
208
+ cinder_nfs_shares = ['<%= @host.deployment.cinder.nfs_uri %>']
209
+ cinder_nfs_mount_options = ''
210
+
211
+ cinder_backend_rbd = '<%= @host.deployment.cinder.ceph_backend? %>'
212
+ # TODO: confirm these params and add them to model where user input is needed
213
+ cinder_rbd_pool = 'volumes'
214
+ cinder_rbd_ceph_conf = '/etc/ceph/ceph.conf/'
215
+ cinder_rbd_flatten_volume_from_snapshot = 'false'
216
+ cinder_rbd_max_clone_depth = '5'
217
+ cinder_rbd_user = 'cinder'
218
+ cinder_rbd_secret_uuid = ''
219
+
220
+ cinder_backend_eqlx = '<%= @host.deployment.cinder.equallogic_backend? %>'
221
+ # TODO: confirm these params and add them to model where user input is needed
222
+ # below dynamic calls are commented out since the model does not yet have san/chap entries
223
+ cinder_san_ip = [''] # ['<%= #@host.deployment.cinder.san_ip %>']
224
+ cinder_san_login = [''] # ['<%= #@host.deployment.cinder.san_login %>']
225
+ cinder_san_password = [''] # ['<%= #@host.deployment.cinder.san_password %>']
226
+ cinder_san_thin_provision = ['false']
227
+ cinder_eqlx_group_name = ['group-0']
228
+ cinder_eqlx_pool = ['default']
229
+ cinder_eqlx_use_chap = ['false']
230
+ cinder_eqlx_chap_login = [''] # ['<%= #@host.deployment.cinder.chap_login %>']
231
+ cinder_eqlx_chap_password = [''] # ['<%= #@host.deployment.cinder.chap_password %>']
232
+
233
+
234
+ # effective_value grabs shared password if deployment is in shared password mode,
235
+ # otherwise use the service-specific one
236
+ admin_pw = '<%= @host.deployment.passwords.effective_value(:admin) %>'
237
+ ceilometer_user_pw = '<%= @host.deployment.passwords.effective_value(:ceilometer_user) %>'
238
+ cinder_db_pw = '<%= @host.deployment.passwords.effective_value(:cinder_db) %>'
239
+ cinder_user_pw = '<%= @host.deployment.passwords.effective_value(:cinder_user) %>'
240
+ glance_db_pw = '<%= @host.deployment.passwords.effective_value(:glance_db) %>'
241
+ glance_user_pw = '<%= @host.deployment.passwords.effective_value(:glance_user) %>'
242
+ heat_db_pw = '<%= @host.deployment.passwords.effective_value(:heat_db) %>'
243
+ heat_user_pw = '<%= @host.deployment.passwords.effective_value(:heat_user) %>'
244
+ heat_cfn_user_pw = '<%= @host.deployment.passwords.effective_value(:heat_cfn_user) %>'
245
+ keystone_db_pw = '<%= @host.deployment.passwords.effective_value(:keystone_db) %>'
246
+ keystone_user_pw = '<%= @host.deployment.passwords.effective_value(:keystone_user) %>'
247
+ mysql_root_pw = '<%= @host.deployment.passwords.effective_value(:mysql_root) %>'
248
+ neutron_db_pw = '<%= @host.deployment.passwords.effective_value(:neutron_db) %>'
249
+ neutron_user_pw = '<%= @host.deployment.passwords.effective_value(:neutron_user) %>'
250
+ nova_db_pw = '<%= @host.deployment.passwords.effective_value(:nova_db) %>'
251
+ nova_user_pw = '<%= @host.deployment.passwords.effective_value(:nova_user) %>'
252
+ swift_admin_pw = '<%= @host.deployment.passwords.effective_value(:swift_admin) %>'
253
+ swift_user_pw = '<%= @host.deployment.passwords.effective_value(:swift_user) %>'
254
+ amqp_pw = '<%= @host.deployment.passwords.effective_value(:amqp) %>'
255
+ amqp_nssdb_pw = '<%= @host.deployment.passwords.effective_value(:amqp_nssdb) %>'
256
+ keystone_admin_token = '<%= @host.deployment.passwords.effective_value(:keystone_admin_token) %>'
257
+
258
+ #these don't share the user-supplied password value; they're always a random per param value
259
+ ceilometer_metering = '<%= @host.deployment.passwords.ceilometer_metering_secret %>'
260
+ heat_auth_encrypt_key = '<%= @host.deployment.passwords.heat_auth_encrypt_key %>'
261
+ horizon_secret_key = '<%= @host.deployment.passwords.horizon_secret_key %>'
262
+ swift_shared_secret = '<%= @host.deployment.passwords.swift_shared_secret %>'
263
+ neutron_metadata_proxy_secret = '<%= @host.deployment.passwords.neutron_metadata_proxy_secret %>'
264
+
265
+ # virtual ip addresses
266
+ vip_format = '<%%= @host.deployment.vips.get(:%s) %%>'
267
+ get_host_format = '<%%= d = @host.deployment; d.ha? ? d.vips.get(:%s) : d.ips.controller_ip %%>'
268
+
269
+ amqp_host = get_host_format % :amqp
270
+ mysql_host = get_host_format % :db
271
+ glance_host = get_host_format % :glance
272
+ auth_host = get_host_format % :keystone
273
+ neutron_host = get_host_format % :neutron
274
+ nova_host = get_host_format % :nova
275
+
276
+ controller_host = '<%= d = @host.deployment; d.ha? ? nil : d.ips.controller_ip %>'
277
+
278
+ {
279
+ 'quickstack::nova_network::controller' => {
280
+ 'amqp_provider' => amqp_provider,
281
+ 'cinder_backend_iscsi' => cinder_backend_iscsi,
282
+ 'cinder_backend_nfs' => cinder_backend_nfs,
283
+ 'cinder_nfs_shares' => cinder_nfs_shares,
284
+ 'cinder_nfs_mount_options' => cinder_nfs_mount_options,
285
+ 'cinder_backend_rbd' => cinder_backend_rbd,
286
+ 'cinder_rbd_pool' => cinder_rbd_pool,
287
+ 'cinder_rbd_ceph_conf' => cinder_rbd_ceph_conf,
288
+ 'cinder_rbd_flatten_volume_from_snapshot' => cinder_rbd_flatten_volume_from_snapshot,
289
+ 'cinder_rbd_max_clone_depth' => cinder_rbd_max_clone_depth,
290
+ 'cinder_rbd_user' => cinder_rbd_user,
291
+ 'cinder_rbd_secret_uuid' => cinder_rbd_secret_uuid,
292
+ 'cinder_backend_eqlx' => cinder_backend_eqlx,
293
+ 'cinder_san_ip' => cinder_san_ip,
294
+ 'cinder_san_login' => cinder_san_login,
295
+ 'cinder_san_password' => cinder_san_password,
296
+ 'cinder_san_thin_provision' => cinder_san_thin_provision,
297
+ 'cinder_eqlx_group_name' => cinder_eqlx_group_name,
298
+ 'cinder_eqlx_pool' => cinder_eqlx_pool,
299
+ 'cinder_eqlx_use_chap' => cinder_eqlx_use_chap,
300
+ 'cinder_eqlx_chap_login' => cinder_eqlx_chap_login,
301
+ 'cinder_eqlx_chap_password' => cinder_eqlx_chap_password,
302
+ 'glance_backend' => backend,
303
+ 'admin_password' => admin_pw,
304
+ 'ceilometer_user_password' => ceilometer_user_pw,
305
+ 'cinder_db_password' => cinder_db_pw,
306
+ 'cinder_user_password' => cinder_user_pw,
307
+ 'glance_db_password' => glance_db_pw,
308
+ 'glance_user_password' => glance_user_pw,
309
+ 'heat_db_password' => heat_db_pw,
310
+ 'heat_user_password' => heat_user_pw,
311
+ 'keystone_db_password' => keystone_db_pw,
312
+ 'mysql_root_password' => mysql_root_pw,
313
+ 'nova_db_password' => nova_db_pw,
314
+ 'nova_user_password' => nova_user_pw,
315
+ 'swift_admin_password' => swift_admin_pw,
316
+ 'amqp_password' => amqp_pw,
317
+ 'amqp_nssdb_password' => amqp_nssdb_pw,
318
+ 'keystone_admin_token' => keystone_admin_token,
319
+ 'ceilometer_metering_secret' => ceilometer_metering,
320
+ 'heat_auth_encrypt_key' => heat_auth_encrypt_key,
321
+ 'horizon_secret_key' => horizon_secret_key,
322
+ 'amqp_host' => amqp_host,
323
+ 'mysql_host' => mysql_host,
324
+ 'swift_shared_secret' => swift_shared_secret,
325
+ 'swift_ringserver_ip' => '',
326
+ 'swift_storage_ips' => '<%= @host.deployment.ips.controller_ips %>',
327
+ 'cinder_nfs_shares' => [],
328
+ 'cinder_gluster_shares' => [],
329
+ 'controller_admin_host' => controller_host,
330
+ 'controller_priv_host' => controller_host,
331
+ 'controller_pub_host' => controller_host },
332
+ 'quickstack::neutron::controller' => {
333
+ 'amqp_provider' => amqp_provider,
334
+ 'ml2_network_vlan_ranges' => ml2_network_vlan_ranges,
335
+ 'ml2_tenant_network_types' => ml2_tenant_network_types,
336
+ 'ml2_tunnel_id_ranges' => ml2_tunnel_id_ranges,
337
+ 'ml2_vni_ranges' => ml2_vni_ranges,
338
+ 'ovs_vlan_ranges' => ovs_vlan_ranges,
339
+ 'enable_tunneling' => enable_tunneling,
340
+ 'cinder_backend_iscsi' => cinder_backend_iscsi,
341
+ 'cinder_backend_nfs' => cinder_backend_nfs,
342
+ 'cinder_nfs_shares' => cinder_nfs_shares,
343
+ 'cinder_nfs_mount_options' => cinder_nfs_mount_options,
344
+ 'cinder_backend_rbd' => cinder_backend_rbd,
345
+ 'cinder_rbd_pool' => cinder_rbd_pool,
346
+ 'cinder_rbd_ceph_conf' => cinder_rbd_ceph_conf,
347
+ 'cinder_rbd_flatten_volume_from_snapshot' => cinder_rbd_flatten_volume_from_snapshot,
348
+ 'cinder_rbd_max_clone_depth' => cinder_rbd_max_clone_depth,
349
+ 'cinder_rbd_user' => cinder_rbd_user,
350
+ 'cinder_rbd_secret_uuid' => cinder_rbd_secret_uuid,
351
+ 'cinder_backend_eqlx' => cinder_backend_eqlx,
352
+ 'cinder_san_ip' => cinder_san_ip,
353
+ 'cinder_san_login' => cinder_san_login,
354
+ 'cinder_san_password' => cinder_san_password,
355
+ 'cinder_san_thin_provision' => cinder_san_thin_provision,
356
+ 'cinder_eqlx_group_name' => cinder_eqlx_group_name,
357
+ 'cinder_eqlx_pool' => cinder_eqlx_pool,
358
+ 'cinder_eqlx_use_chap' => cinder_eqlx_use_chap,
359
+ 'cinder_eqlx_chap_login' => cinder_eqlx_chap_login,
360
+ 'cinder_eqlx_chap_password' => cinder_eqlx_chap_password,
361
+ 'glance_backend' => backend,
362
+ 'admin_password' => admin_pw,
363
+ 'ceilometer_user_password' => ceilometer_user_pw,
364
+ 'cinder_db_password' => cinder_db_pw,
365
+ 'cinder_user_password' => cinder_user_pw,
366
+ 'glance_db_password' => glance_db_pw,
367
+ 'glance_user_password' => glance_user_pw,
368
+ 'heat_db_password' => heat_db_pw,
369
+ 'heat_user_password' => heat_user_pw,
370
+ 'keystone_db_password' => keystone_db_pw,
371
+ 'mysql_root_password' => mysql_root_pw,
372
+ 'neutron_db_password' => neutron_db_pw,
373
+ 'neutron_user_password' => neutron_user_pw,
374
+ 'nova_db_password' => nova_db_pw,
375
+ 'nova_user_password' => nova_user_pw,
376
+ 'swift_admin_password' => swift_admin_pw,
377
+ 'amqp_password' => amqp_pw,
378
+ 'amqp_nssdb_password' => amqp_nssdb_pw,
379
+ 'keystone_admin_token' => keystone_admin_token,
380
+ 'ceilometer_metering_secret' => ceilometer_metering,
381
+ 'heat_auth_encrypt_key' => heat_auth_encrypt_key,
382
+ 'horizon_secret_key' => horizon_secret_key,
383
+ 'swift_shared_secret' => swift_shared_secret,
384
+ 'neutron_metadata_proxy_secret' => neutron_metadata_proxy_secret,
385
+ 'amqp_host' => amqp_host,
386
+ 'mysql_host' => mysql_host,
387
+ 'swift_shared_secret' => swift_shared_secret,
388
+ 'swift_ringserver_ip' => '',
389
+ 'swift_storage_ips' => '<%= @host.deployment.ips.controller_ips %>',
390
+ 'cinder_nfs_shares' => [],
391
+ 'cinder_gluster_shares' => [],
392
+ 'controller_admin_host' => controller_host,
393
+ 'controller_priv_host' => controller_host,
394
+ 'controller_pub_host' => controller_host },
395
+ 'quickstack::pacemaker::params' => {
396
+ 'include_neutron' => neutron,
397
+ 'neutron' => neutron,
398
+ 'ceilometer_user_password' => ceilometer_user_pw,
399
+ 'cinder_db_password' => cinder_db_pw,
400
+ 'cinder_user_password' => cinder_user_pw,
401
+ 'glance_db_password' => glance_db_pw,
402
+ 'glance_user_password' => glance_user_pw,
403
+ 'heat_db_password' => heat_db_pw,
404
+ 'heat_user_password' => heat_user_pw,
405
+ 'heat_cfn_user_password' => heat_cfn_user_pw,
406
+ 'keystone_db_password' => keystone_db_pw,
407
+ 'keystone_user_password' => keystone_user_pw,
408
+ 'neutron_db_password' => neutron_db_pw,
409
+ 'neutron_user_password' => neutron_user_pw,
410
+ 'nova_db_password' => nova_db_pw,
411
+ 'nova_user_password' => nova_user_pw,
412
+ 'amqp_password' => amqp_pw,
413
+ 'heat_auth_encryption_key' => heat_auth_encrypt_key,
414
+ 'neutron_metadata_proxy_secret' => neutron_metadata_proxy_secret,
415
+ 'ceilometer_admin_vip' => vip_format % :ceilometer,
416
+ 'ceilometer_private_vip' => vip_format % :ceilometer,
417
+ 'ceilometer_public_vip' => vip_format % :ceilometer,
418
+ 'cinder_admin_vip' => vip_format % :cinder,
419
+ 'cinder_private_vip' => vip_format % :cinder,
420
+ 'cinder_public_vip' => vip_format % :cinder,
421
+ 'db_vip' => vip_format % :db,
422
+ 'glance_admin_vip' => vip_format % :glance,
423
+ 'glance_private_vip' => vip_format % :glance,
424
+ 'glance_public_vip' => vip_format % :glance,
425
+ 'heat_admin_vip' => vip_format % :heat,
426
+ 'heat_cfn_admin_vip' => vip_format % :heat,
427
+ 'heat_cfn_private_vip' => vip_format % :heat,
428
+ 'heat_cfn_public_vip' => vip_format % :heat,
429
+ 'heat_private_vip' => vip_format % :heat,
430
+ 'heat_public_vip' => vip_format % :heat,
431
+ 'horizon_admin_vip' => vip_format % :horizon,
432
+ 'horizon_private_vip' => vip_format % :horizon,
433
+ 'horizon_public_vip' => vip_format % :horizon,
434
+ 'keystone_admin_vip' => vip_format % :keystone,
435
+ 'keystone_private_vip' => vip_format % :keystone,
436
+ 'keystone_public_vip' => vip_format % :keystone,
437
+ 'loadbalancer_vip' => vip_format % :loadbalancer,
438
+ 'neutron_admin_vip' => vip_format % :neutron,
439
+ 'neutron_private_vip' => vip_format % :neutron,
440
+ 'neutron_public_vip' => vip_format % :neutron,
441
+ 'nova_admin_vip' => vip_format % :nova,
442
+ 'nova_private_vip' => vip_format % :nova,
443
+ 'nova_public_vip' => vip_format % :nova,
444
+ 'amqp_vip' => vip_format % :amqp,
445
+ 'swift_public_vip' => vip_format % :swift,
446
+ 'lb_backend_server_addrs' => '<%= @host.deployment.ips.controller_ips %>',
447
+ 'lb_backend_server_names' => '<%= @host.deployment.ips.controller_fqdns %>' },
448
+ 'quickstack::pacemaker::common' => { # TODO is this correct puppetclass?
449
+ 'pacemaker_cluster_members' => '<%= @host.deployment.ips.controller_ips.join(" ") %>' },
450
+ 'quickstack::pacemaker::neutron' => {
451
+ 'ml2_network_vlan_ranges' => ml2_network_vlan_ranges,
452
+ 'ml2_tenant_network_types' => ml2_tenant_network_types,
453
+ 'ml2_tunnel_id_ranges' => ml2_tunnel_id_ranges,
454
+ 'enable_tunneling' => enable_tunneling,
455
+ 'ovs_bridge_mappings' => ovs_bridge_mappings,
456
+ 'ovs_bridge_uplinks' => ovs_bridge_uplinks,
457
+ 'ovs_tunnel_iface' => ovs_tunnel_iface,
458
+ 'ovs_tunnel_types' => ovs_tunnel_types,
459
+ 'ovs_vlan_ranges' => ovs_vlan_ranges },
460
+ 'quickstack::pacemaker::glance' => {
461
+ 'backend' => backend,
462
+ 'pcmk_fs_type' => pcmk_fs_type,
463
+ 'pcmk_fs_device' => pcmk_fs_device,
464
+ 'pcmk_fs_dir' => pcmk_fs_dir,
465
+ 'pcmk_fs_manage' => pcmk_fs_manage,
466
+ 'pcmk_fs_options' => pcmk_fs_options },
467
+ 'quickstack::pacemaker::cinder' => {
468
+ 'volume' => volume,
469
+ 'backend_iscsi' => cinder_backend_iscsi,
470
+ 'backend_nfs' => cinder_backend_nfs,
471
+ 'nfs_shares' => cinder_nfs_shares,
472
+ 'nfs_mount_options' => cinder_nfs_mount_options,
473
+ 'backend_rbd' => cinder_backend_rbd,
474
+ 'rbd_pool' => cinder_rbd_pool,
475
+ 'rbd_ceph_conf' => cinder_rbd_ceph_conf,
476
+ 'rbd_flatten_volume_from_snapshot' => cinder_rbd_flatten_volume_from_snapshot,
477
+ 'rbd_max_clone_depth' => cinder_rbd_max_clone_depth,
478
+ 'rbd_user' => cinder_rbd_user,
479
+ 'rbd_secret_uuid' => cinder_rbd_secret_uuid,
480
+ 'backend_eqlx' => cinder_backend_eqlx,
481
+ 'san_ip' => cinder_san_ip,
482
+ 'san_login' => cinder_san_login,
483
+ 'san_password' => cinder_san_password,
484
+ 'san_thin_provision' => cinder_san_thin_provision,
485
+ 'eqlx_group_name' => cinder_eqlx_group_name,
486
+ 'eqlx_pool' => cinder_eqlx_pool,
487
+ 'eqlx_use_chap' => cinder_eqlx_use_chap,
488
+ 'eqlx_chap_login' => cinder_eqlx_chap_login,
489
+ 'eqlx_chap_password' => cinder_eqlx_chap_password },
490
+ 'quickstack::pacemaker::keystone' => {
491
+ 'admin_password' => admin_pw,
492
+ 'admin_token' => keystone_admin_token },
493
+ 'quickstack::pacemaker::horizon' => {
494
+ 'secret_key' => horizon_secret_key },
495
+ 'quickstack::pacemaker::galera' => {
496
+ 'mysql_root_password' => mysql_root_pw,
497
+ 'wsrep_cluster_members' => '<%= @host.deployment.ips.controller_ips %>' },
498
+ 'quickstack::pacemaker::swift' => {
499
+ 'swift_shared_secret' => swift_shared_secret,
500
+ 'swift_internal_vip' => vip_format % :swift,
501
+ 'swift_storage_ips' => [] },
502
+ 'quickstack::pacemaker::nova' => {
503
+ 'multi_host' => 'true',
504
+ 'neutron_metadata_proxy_secret' => neutron_metadata_proxy_secret },
505
+ 'quickstack::neutron::networker' => {
506
+ 'amqp_provider' => amqp_provider,
507
+ 'enable_tunneling' => enable_tunneling,
508
+ 'ovs_bridge_mappings' => ovs_bridge_mappings,
509
+ 'ovs_bridge_uplinks' => ovs_bridge_uplinks,
510
+ 'ovs_tunnel_iface' => ovs_tunnel_iface,
511
+ 'ovs_tunnel_types' => ovs_tunnel_types,
512
+ 'ovs_vlan_ranges' => ovs_vlan_ranges,
513
+ 'neutron_db_password' => neutron_db_pw,
514
+ 'neutron_user_password' => neutron_user_pw,
515
+ 'nova_db_password' => nova_db_pw,
516
+ 'nova_user_password' => nova_user_pw,
517
+ 'amqp_password' => amqp_pw,
518
+ 'neutron_metadata_proxy_secret' => neutron_metadata_proxy_secret,
519
+ 'amqp_host' => amqp_host,
520
+ 'mysql_host' => mysql_host,
521
+ 'controller_priv_host' => controller_host },
522
+ 'quickstack::storage_backend::cinder' => {
523
+ 'amqp_provider' => amqp_provider,
524
+ 'cinder_db_password' => cinder_db_pw,
525
+ 'cinder_user_password' => cinder_user_pw,
526
+ 'amqp_password' => amqp_pw },
527
+ 'quickstack::nova_network::compute' => {
528
+ 'amqp_provider' => amqp_provider,
529
+ 'network_manager' => network_manager,
530
+ 'network_overrides' => network_overrides,
531
+ 'network_num_networks' => network_num_networks,
532
+ 'network_network_size' => network_network_size,
533
+ 'network_fixed_range' => network_fixed_range,
534
+ 'network_floating_range' => network_floating_range,
535
+ 'network_private_iface' => network_private_iface,
536
+ 'network_public_iface' => network_public_iface,
537
+ 'network_create_networks' => network_create_networks,
538
+ 'nova_multi_host' => 'true',
539
+ 'admin_password' => admin_pw,
540
+ 'ceilometer_user_password' => ceilometer_user_pw,
541
+ 'nova_db_password' => nova_db_pw,
542
+ 'nova_user_password' => nova_user_pw,
543
+ 'amqp_password' => amqp_pw,
544
+ 'ceilometer_metering_secret' => ceilometer_metering,
545
+ 'amqp_host' => amqp_host,
546
+ 'mysql_host' => mysql_host,
547
+ 'glance_host' => glance_host,
548
+ 'auth_host' => auth_host,
549
+ 'nova_host' => nova_host },
550
+ 'quickstack::neutron::compute' => {
551
+ 'amqp_provider' => amqp_provider,
552
+ 'enable_tunneling' => enable_tunneling,
553
+ 'ovs_bridge_mappings' => compute_ovs_bridge_mappings,
554
+ 'ovs_bridge_uplinks' => compute_ovs_bridge_uplinks,
555
+ 'ovs_tunnel_iface' => compute_ovs_tunnel_iface,
556
+ 'ovs_tunnel_types' => ovs_tunnel_types,
557
+ 'ovs_vlan_ranges' => ovs_vlan_ranges,
558
+ 'admin_password' => admin_pw,
559
+ 'ceilometer_user_password' => ceilometer_user_pw,
560
+ 'neutron_db_password' => neutron_db_pw,
561
+ 'neutron_user_password' => neutron_user_pw,
562
+ 'nova_db_password' => nova_db_pw,
563
+ 'nova_user_password' => nova_user_pw,
564
+ 'amqp_password' => amqp_pw,
565
+ 'ceilometer_metering_secret' => ceilometer_metering,
566
+ 'amqp_host' => amqp_host,
567
+ 'mysql_host' => mysql_host,
568
+ 'glance_host' => glance_host,
569
+ 'auth_host' => auth_host,
570
+ 'neutron_host' => neutron_host,
571
+ 'nova_host' => nova_host },
572
+ 'quickstack::pacemaker::rsync::keystone' => {
573
+ 'keystone_private_vip' => vip_format % :keystone } }
574
+ end
575
+
576
+ def get_key_type(value)
577
+ key_list = LookupKey::KEY_TYPES
578
+ value_type = value.class.to_s.downcase
579
+ if key_list.include?(value_type)
580
+ value_type
581
+ elsif [FalseClass, TrueClass].include? value.class
582
+ 'boolean'
583
+ else
584
+ raise
585
+ end
586
+ # If we need to handle actual number classes like Fixnum, add those here
587
+ end
588
+
589
+ def seed_layouts
590
+ LAYOUTS.each do |key, layout_hash|
591
+ LAYOUTS[key][:obj] = Staypuft::Layout.where(layout_hash).first_or_create!
592
+ end
593
+ end
594
+
595
+ def seed_services
596
+ SERVICES.each do |key, service_hash|
597
+ service = Staypuft::Service.where(:name => service_hash[:name]).first_or_create!
598
+
599
+ puppet_classes = collect_puppet_classes(Array(service_hash[:class]))
600
+ puppet_classes.each { |pc| apply_astapor_defaults pc }
601
+ service.puppetclasses = puppet_classes
602
+
603
+ service.description = service_hash[:description]
604
+ service.save!
605
+ service_hash[:obj] = service
606
+ end
607
+ end
608
+
609
+ def seed_roles
610
+ ROLES.each do |role_hash|
611
+ role = Staypuft::Role.where(:name => role_hash[:name]).first_or_create!
612
+
613
+ puppet_classes = collect_puppet_classes(Array(role_hash[:class]))
614
+ puppet_classes.each { |pc| apply_astapor_defaults pc }
615
+ role.puppetclasses = puppet_classes
616
+
617
+ role.description = role_hash[:description]
618
+ old_role_services_arr = role.role_services.to_a
619
+ role_hash[:services].each do |key|
620
+ role_service = role.role_services.where(:service_id => SERVICES[key][:obj].id).first_or_create!
621
+ old_role_services_arr.delete(role_service)
622
+ end
623
+
624
+ # delete any prior mappings that remain
625
+ old_role_services_arr.each do |role_service|
626
+ role.services.destroy(role_service.service)
627
+ end
628
+ role.save!
629
+ old_layout_roles_arr = role.layout_roles.to_a
630
+ role_hash[:layouts].each do |layout, deploy_order|
631
+ layout_role = role.layout_roles.where(:layout_id => LAYOUTS[layout][:obj].id).first_or_initialize
632
+ layout_role.deploy_order = deploy_order
633
+ layout_role.save!
634
+ old_layout_roles_arr.delete(layout_role)
635
+ end
636
+ # delete any prior mappings that remain
637
+ old_layout_roles_arr.each do |layout_role|
638
+ role.layouts.destroy(layout_role.layout)
639
+ end
640
+ end
641
+ end
642
+
643
+ def seed_functional_dependencies
644
+ functional_dependencies.each do |puppetclass_name, params|
645
+ puppetclass = Puppetclass.find_by_name(puppetclass_name)
646
+ unless puppetclass
647
+ Rails.logger.error "missing puppet class #{puppetclass_name}"
648
+ next
649
+ end
650
+ params.each do |param_key, default_value|
651
+ param = puppetclass.class_params.find_by_key(param_key)
652
+ unless param
653
+ Rails.logger.error "missing param #{param_key} in #{puppetclass_name} trying to set default_value: #{default_value.inspect} found in puppetclasses: " +
654
+ LookupKey.
655
+ smart_class_parameters.
656
+ search_for("key = #{param_key}").
657
+ map { |lk| lk.param_class.name }.inspect
658
+ next
659
+ end
660
+ unless param.update_attributes default_value: default_value
661
+ Rails.logger.error "param #{param_key} in #{puppetclass_name} default_value: #{default_value.inspect} is invalid"
662
+ end
663
+ end
664
+ end
665
+ end
666
+
667
+ def seed
668
+ seed_layouts
669
+ seed_services
670
+ seed_roles
671
+ seed_functional_dependencies
672
+ end
673
+
674
+ def collect_puppet_classes(puppet_class_names)
675
+ puppet_class_names.map do |puppet_class_name|
676
+ Puppetclass.find_by_name(puppet_class_name).tap do |v|
677
+ Rails.logger.warn "no puppet_class: #{puppet_class_name} found" unless v
678
+ end
679
+ end.compact
680
+ end
681
+
682
+ def apply_astapor_defaults(puppet_class)
683
+ puppet_class.class_params.each do |param|
684
+ if ASTAPOR_PARAMS.include?(param.key)
685
+ param.key_type = get_key_type(ASTAPOR_PARAMS[param.key])
686
+ param.default_value = ASTAPOR_PARAMS[param.key]
687
+ end
688
+ param.override = true
689
+ param.save!
690
+ end
691
+ puppet_class
692
+ end
693
+ end
694
+ end
695
+
696
+ # require 'set'
697
+ # applied_params = Set.new
698
+ #
699
+ # not_applied_params = ASTAPOR_PARAMS.keys - applied_params.to_a
700
+ # unless not_applied_params.empty?
701
+ # Rails.logger.error "following params were not applied: #{not_applied_params.inspect}"
702
+ # end