Merge "composable keystone services"
[apex-tripleo-heat-templates.git] / puppet / manifests / overcloud_controller.pp
1 # Copyright 2014 Red Hat, Inc.
2 # All Rights Reserved.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License"); you may
5 # not use this file except in compliance with the License. You may obtain
6 # a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 # License for the specific language governing permissions and limitations
14 # under the License.
15
16 include ::tripleo::packages
17 include ::tripleo::firewall
18
19 $enable_load_balancer = hiera('enable_load_balancer', true)
20
21 if hiera('step') >= 1 {
22
23   create_resources(kmod::load, hiera('kernel_modules'), {})
24   create_resources(sysctl::value, hiera('sysctl_settings'), {})
25   Exec <| tag == 'kmod::load' |>  -> Sysctl <| |>
26
27   $controller_node_ips = split(hiera('controller_node_ips'), ',')
28
29   if $enable_load_balancer {
30     class { '::tripleo::loadbalancer' :
31       controller_hosts => $controller_node_ips,
32       manage_vip       => true,
33     }
34   }
35
36 }
37
38 if hiera('step') >= 2 {
39
40   if count(hiera('ntp::servers')) > 0 {
41     include ::ntp
42   }
43
44   include ::timezone
45
46   # MongoDB
47   if downcase(hiera('ceilometer_backend')) == 'mongodb' {
48     include ::mongodb::globals
49     include ::mongodb::client
50     include ::mongodb::server
51     # NOTE(gfidente): We need to pass the list of IPv6 addresses *with* port and
52     # without the brackets as 'members' argument for the 'mongodb_replset'
53     # resource.
54     if str2bool(hiera('mongodb::server::ipv6', false)) {
55       $mongo_node_ips_with_port_prefixed = prefix(hiera('mongo_node_ips'), '[')
56       $mongo_node_ips_with_port = suffix($mongo_node_ips_with_port_prefixed, ']:27017')
57       $mongo_node_ips_with_port_nobr = suffix(hiera('mongo_node_ips'), ':27017')
58     } else {
59       $mongo_node_ips_with_port = suffix(hiera('mongo_node_ips'), ':27017')
60       $mongo_node_ips_with_port_nobr = suffix(hiera('mongo_node_ips'), ':27017')
61     }
62     $mongo_node_string = join($mongo_node_ips_with_port, ',')
63
64     $mongodb_replset = hiera('mongodb::server::replset')
65     $ceilometer_mongodb_conn_string = "mongodb://${mongo_node_string}/ceilometer?replicaSet=${mongodb_replset}"
66     if downcase(hiera('bootstrap_nodeid')) == $::hostname {
67       mongodb_replset { $mongodb_replset :
68         members => $mongo_node_ips_with_port_nobr,
69       }
70     }
71   }
72
73   # Redis
74   $redis_node_ips = hiera('redis_node_ips')
75   $redis_master_hostname = downcase(hiera('bootstrap_nodeid'))
76
77   if $redis_master_hostname == $::hostname {
78     $slaveof = undef
79   } else {
80     $slaveof = "${redis_master_hostname} 6379"
81   }
82   class {'::redis' :
83     slaveof => $slaveof,
84   }
85
86   if count($redis_node_ips) > 1 {
87     Class['::tripleo::redis_notification'] -> Service['redis-sentinel']
88     include ::redis::sentinel
89     include ::tripleo::redis_notification
90   }
91
92   if str2bool(hiera('enable_galera', true)) {
93     $mysql_config_file = '/etc/my.cnf.d/galera.cnf'
94   } else {
95     $mysql_config_file = '/etc/my.cnf.d/server.cnf'
96   }
97   # TODO Galara
98   # FIXME: due to https://bugzilla.redhat.com/show_bug.cgi?id=1298671 we
99   # set bind-address to a hostname instead of an ip address; to move Mysql
100   # from internal_api on another network we'll have to customize both
101   # MysqlNetwork and ControllerHostnameResolveNetwork in ServiceNetMap
102   class { '::mysql::server':
103     config_file             => $mysql_config_file,
104     override_options        => {
105       'mysqld' => {
106         'bind-address'     => $::hostname,
107         'max_connections'  => hiera('mysql_max_connections'),
108         'open_files_limit' => '-1',
109       },
110     },
111     remove_default_accounts => true,
112   }
113
114   # FIXME: this should only occur on the bootstrap host (ditto for db syncs)
115   # Create all the database schemas
116   include ::keystone::db::mysql
117   include ::glance::db::mysql
118   include ::nova::db::mysql
119   include ::nova::db::mysql_api
120   include ::neutron::db::mysql
121   include ::cinder::db::mysql
122   include ::heat::db::mysql
123   include ::sahara::db::mysql
124   if downcase(hiera('ceilometer_backend')) == 'mysql' {
125     include ::ceilometer::db::mysql
126     include ::aodh::db::mysql
127   }
128
129   $rabbit_nodes = hiera('rabbit_node_ips')
130   if count($rabbit_nodes) > 1 {
131
132     $rabbit_ipv6 = str2bool(hiera('rabbit_ipv6', false))
133     if $rabbit_ipv6 {
134       $rabbit_env = merge(hiera('rabbitmq_environment'), {
135         'RABBITMQ_SERVER_START_ARGS' => '"-proto_dist inet6_tcp"'
136       })
137     } else {
138       $rabbit_env = hiera('rabbitmq_environment')
139     }
140
141     class { '::rabbitmq':
142       config_cluster          => true,
143       cluster_nodes           => $rabbit_nodes,
144       tcp_keepalive           => false,
145       config_kernel_variables => hiera('rabbitmq_kernel_variables'),
146       config_variables        => hiera('rabbitmq_config_variables'),
147       environment_variables   => $rabbit_env,
148     }
149     rabbitmq_policy { 'ha-all@/':
150       pattern    => '^(?!amq\.).*',
151       definition => {
152         'ha-mode' => 'all',
153       },
154     }
155   } else {
156     include ::rabbitmq
157   }
158
159   # pre-install swift here so we can build rings
160   include ::swift
161
162   $enable_ceph = hiera('ceph_storage_count', 0) > 0 or hiera('enable_ceph_storage', false)
163
164   if $enable_ceph {
165     $mon_initial_members = downcase(hiera('ceph_mon_initial_members'))
166     if str2bool(hiera('ceph_ipv6', false)) {
167       $mon_host = hiera('ceph_mon_host_v6')
168     } else {
169       $mon_host = hiera('ceph_mon_host')
170     }
171     class { '::ceph::profile::params':
172       mon_initial_members => $mon_initial_members,
173       mon_host            => $mon_host,
174     }
175     include ::ceph::conf
176     include ::ceph::profile::mon
177   }
178
179   if str2bool(hiera('enable_ceph_storage', false)) {
180     if str2bool(hiera('ceph_osd_selinux_permissive', true)) {
181       exec { 'set selinux to permissive on boot':
182         command => "sed -ie 's/^SELINUX=.*/SELINUX=permissive/' /etc/selinux/config",
183         onlyif  => "test -f /etc/selinux/config && ! grep '^SELINUX=permissive' /etc/selinux/config",
184         path    => ['/usr/bin', '/usr/sbin'],
185       }
186
187       exec { 'set selinux to permissive':
188         command => 'setenforce 0',
189         onlyif  => "which setenforce && getenforce | grep -i 'enforcing'",
190         path    => ['/usr/bin', '/usr/sbin'],
191       } -> Class['ceph::profile::osd']
192     }
193
194     include ::ceph::conf
195     include ::ceph::profile::osd
196   }
197
198   if str2bool(hiera('enable_external_ceph', false)) {
199     if str2bool(hiera('ceph_ipv6', false)) {
200       $mon_host = hiera('ceph_mon_host_v6')
201     } else {
202       $mon_host = hiera('ceph_mon_host')
203     }
204     class { '::ceph::profile::params':
205       mon_host            => $mon_host,
206     }
207     include ::ceph::conf
208     include ::ceph::profile::client
209   }
210
211 } #END STEP 2
212
213 if hiera('step') >= 4 {
214
215   $glance_backend = downcase(hiera('glance_backend', 'swift'))
216   case $glance_backend {
217       'swift': { $backend_store = 'glance.store.swift.Store' }
218       'file': { $backend_store = 'glance.store.filesystem.Store' }
219       'rbd': { $backend_store = 'glance.store.rbd.Store' }
220       default: { fail('Unrecognized glance_backend parameter.') }
221   }
222   $http_store = ['glance.store.http.Store']
223   $glance_store = concat($http_store, $backend_store)
224
225   # TODO: scrubber and other additional optional features
226   include ::glance
227   include ::glance::config
228   class { '::glance::api':
229     known_stores => $glance_store,
230   }
231   include ::glance::registry
232   include ::glance::notify::rabbitmq
233   include join(['::glance::backend::', $glance_backend])
234
235   $nova_ipv6 = hiera('nova::use_ipv6', false)
236   if $nova_ipv6 {
237     $memcached_servers = suffix(hiera('memcache_node_ips_v6'), ':11211')
238   } else {
239     $memcached_servers = suffix(hiera('memcache_node_ips'), ':11211')
240   }
241
242   class { '::nova' :
243     memcached_servers => $memcached_servers
244   }
245   include ::nova::config
246   include ::nova::api
247   include ::nova::cert
248   include ::nova::conductor
249   include ::nova::consoleauth
250   include ::nova::network::neutron
251   include ::nova::vncproxy
252   include ::nova::scheduler
253   include ::nova::scheduler::filter
254
255   if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
256
257     # TODO(devvesa) provide non-controller ips for these services
258     $zookeeper_node_ips = hiera('neutron_api_node_ips')
259     $cassandra_node_ips = hiera('neutron_api_node_ips')
260
261     # Run zookeeper in the controller if configured
262     if hiera('enable_zookeeper_on_controller') {
263       class {'::tripleo::cluster::zookeeper':
264         zookeeper_server_ips => $zookeeper_node_ips,
265         # TODO: create a 'bind' hiera key for zookeeper
266         zookeeper_client_ip  => hiera('neutron::bind_host'),
267         zookeeper_hostnames  => hiera('controller_node_names')
268       }
269     }
270
271     # Run cassandra in the controller if configured
272     if hiera('enable_cassandra_on_controller') {
273       class {'::tripleo::cluster::cassandra':
274         cassandra_servers => $cassandra_node_ips,
275         # TODO: create a 'bind' hiera key for cassandra
276         cassandra_ip      => hiera('neutron::bind_host'),
277       }
278     }
279
280     class {'::tripleo::network::midonet::agent':
281       zookeeper_servers => $zookeeper_node_ips,
282       cassandra_seeds   => $cassandra_node_ips
283     }
284
285     class {'::tripleo::network::midonet::api':
286       zookeeper_servers    => $zookeeper_node_ips,
287       vip                  => hiera('tripleo::loadbalancer::public_virtual_ip'),
288       keystone_ip          => hiera('tripleo::loadbalancer::public_virtual_ip'),
289       keystone_admin_token => hiera('keystone::admin_token'),
290       # TODO: create a 'bind' hiera key for api
291       bind_address         => hiera('neutron::bind_host'),
292       admin_password       => hiera('admin_password')
293     }
294
295     # TODO: find a way to get an empty list from hiera
296     class {'::neutron':
297       service_plugins => []
298     }
299
300   }
301   else {
302
303     # ML2 plugin
304     include ::neutron
305   }
306
307   include ::neutron::config
308   include ::neutron::server
309   include ::neutron::server::notifications
310
311   # If the value of core plugin is set to 'nuage' or'opencontrail' or 'plumgrid',
312   # include nuage or opencontrail or plumgrid core plugins
313   # else use the default value of 'ml2'
314   if hiera('neutron::core_plugin') == 'neutron.plugins.nuage.plugin.NuagePlugin' {
315     include ::neutron::plugins::nuage
316   } elsif hiera('neutron::core_plugin') == 'neutron_plugin_contrail.plugins.opencontrail.contrail_plugin.NeutronPluginContrailCoreV2' {
317     include ::neutron::plugins::opencontrail
318   }
319   elsif hiera('neutron::core_plugin') == 'networking_plumgrid.neutron.plugins.plugin.NeutronPluginPLUMgridV2' {
320     class { '::neutron::plugins::plumgrid' :
321       connection                   => hiera('neutron::server::database_connection'),
322       controller_priv_host         => hiera('keystone_admin_api_vip'),
323       admin_password               => hiera('admin_password'),
324       metadata_proxy_shared_secret => hiera('nova::api::neutron_metadata_proxy_shared_secret'),
325     }
326   } else {
327     include ::neutron::agents::l3
328     include ::neutron::agents::dhcp
329     include ::neutron::agents::metadata
330
331     file { '/etc/neutron/dnsmasq-neutron.conf':
332       content => hiera('neutron_dnsmasq_options'),
333       owner   => 'neutron',
334       group   => 'neutron',
335       notify  => Service['neutron-dhcp-service'],
336       require => Package['neutron'],
337     }
338
339     # If the value of core plugin is set to 'midonet',
340     # skip all the ML2 configuration
341     if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
342
343       class {'::neutron::plugins::midonet':
344         midonet_api_ip    => hiera('tripleo::loadbalancer::public_virtual_ip'),
345         keystone_tenant   => hiera('neutron::server::auth_tenant'),
346         keystone_password => hiera('neutron::server::auth_password')
347       }
348     } else {
349
350       include ::neutron::plugins::ml2
351       include ::neutron::agents::ml2::ovs
352
353       if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') {
354         include ::neutron::plugins::ml2::cisco::nexus1000v
355
356         class { '::neutron::agents::n1kv_vem':
357           n1kv_source  => hiera('n1kv_vem_source', undef),
358           n1kv_version => hiera('n1kv_vem_version', undef),
359         }
360
361         class { '::n1k_vsm':
362           n1kv_source       => hiera('n1kv_vsm_source', undef),
363           n1kv_version      => hiera('n1kv_vsm_version', undef),
364           pacemaker_control => false,
365         }
366       }
367
368       if 'cisco_ucsm' in hiera('neutron::plugins::ml2::mechanism_drivers') {
369         include ::neutron::plugins::ml2::cisco::ucsm
370       }
371       if 'cisco_nexus' in hiera('neutron::plugins::ml2::mechanism_drivers') {
372         include ::neutron::plugins::ml2::cisco::nexus
373         include ::neutron::plugins::ml2::cisco::type_nexus_vxlan
374       }
375
376       if 'bsn_ml2' in hiera('neutron::plugins::ml2::mechanism_drivers') {
377         include ::neutron::plugins::ml2::bigswitch::restproxy
378         include ::neutron::agents::bigswitch
379       }
380       neutron_l3_agent_config {
381         'DEFAULT/ovs_use_veth': value => hiera('neutron_ovs_use_veth', false);
382       }
383       neutron_dhcp_agent_config {
384         'DEFAULT/ovs_use_veth': value => hiera('neutron_ovs_use_veth', false);
385       }
386       Service['neutron-server'] -> Service['neutron-ovs-agent-service']
387     }
388
389     Service['neutron-server'] -> Service['neutron-dhcp-service']
390     Service['neutron-server'] -> Service['neutron-l3']
391     Service['neutron-server'] -> Service['neutron-metadata']
392   }
393
394   include ::cinder
395   include ::cinder::config
396   include ::tripleo::ssl::cinder_config
397   include ::cinder::api
398   include ::cinder::glance
399   include ::cinder::scheduler
400   include ::cinder::volume
401   include ::cinder::ceilometer
402   class { '::cinder::setup_test_volume':
403     size => join([hiera('cinder_lvm_loop_device_size'), 'M']),
404   }
405
406   $cinder_enable_iscsi = hiera('cinder_enable_iscsi_backend', true)
407   if $cinder_enable_iscsi {
408     $cinder_iscsi_backend = 'tripleo_iscsi'
409
410     cinder::backend::iscsi { $cinder_iscsi_backend :
411       iscsi_ip_address => hiera('cinder_iscsi_ip_address'),
412       iscsi_helper     => hiera('cinder_iscsi_helper'),
413     }
414   }
415
416   if $enable_ceph {
417
418     $ceph_pools = hiera('ceph_pools')
419     ceph::pool { $ceph_pools :
420       pg_num  => hiera('ceph::profile::params::osd_pool_default_pg_num'),
421       pgp_num => hiera('ceph::profile::params::osd_pool_default_pgp_num'),
422       size    => hiera('ceph::profile::params::osd_pool_default_size'),
423     }
424
425     $cinder_pool_requires = [Ceph::Pool[hiera('cinder_rbd_pool_name')]]
426
427   } else {
428     $cinder_pool_requires = []
429   }
430
431   if hiera('cinder_enable_rbd_backend', false) {
432     $cinder_rbd_backend = 'tripleo_ceph'
433
434     cinder::backend::rbd { $cinder_rbd_backend :
435       rbd_pool        => hiera('cinder_rbd_pool_name'),
436       rbd_user        => hiera('ceph_client_user_name'),
437       rbd_secret_uuid => hiera('ceph::profile::params::fsid'),
438       require         => $cinder_pool_requires,
439     }
440   }
441
442   if hiera('cinder_enable_eqlx_backend', false) {
443     $cinder_eqlx_backend = hiera('cinder::backend::eqlx::volume_backend_name')
444
445     cinder::backend::eqlx { $cinder_eqlx_backend :
446       volume_backend_name => hiera('cinder::backend::eqlx::volume_backend_name', undef),
447       san_ip              => hiera('cinder::backend::eqlx::san_ip', undef),
448       san_login           => hiera('cinder::backend::eqlx::san_login', undef),
449       san_password        => hiera('cinder::backend::eqlx::san_password', undef),
450       san_thin_provision  => hiera('cinder::backend::eqlx::san_thin_provision', undef),
451       eqlx_group_name     => hiera('cinder::backend::eqlx::eqlx_group_name', undef),
452       eqlx_pool           => hiera('cinder::backend::eqlx::eqlx_pool', undef),
453       eqlx_use_chap       => hiera('cinder::backend::eqlx::eqlx_use_chap', undef),
454       eqlx_chap_login     => hiera('cinder::backend::eqlx::eqlx_chap_login', undef),
455       eqlx_chap_password  => hiera('cinder::backend::eqlx::eqlx_san_password', undef),
456     }
457   }
458
459   if hiera('cinder_enable_dellsc_backend', false) {
460     $cinder_dellsc_backend = hiera('cinder::backend::dellsc_iscsi::volume_backend_name')
461
462     cinder::backend::dellsc_iscsi{ $cinder_dellsc_backend :
463       volume_backend_name   => hiera('cinder::backend::dellsc_iscsi::volume_backend_name', undef),
464       san_ip                => hiera('cinder::backend::dellsc_iscsi::san_ip', undef),
465       san_login             => hiera('cinder::backend::dellsc_iscsi::san_login', undef),
466       san_password          => hiera('cinder::backend::dellsc_iscsi::san_password', undef),
467       dell_sc_ssn           => hiera('cinder::backend::dellsc_iscsi::dell_sc_ssn', undef),
468       iscsi_ip_address      => hiera('cinder::backend::dellsc_iscsi::iscsi_ip_address', undef),
469       iscsi_port            => hiera('cinder::backend::dellsc_iscsi::iscsi_port', undef),
470       dell_sc_api_port      => hiera('cinder::backend::dellsc_iscsi::dell_sc_api_port', undef),
471       dell_sc_server_folder => hiera('cinder::backend::dellsc_iscsi::dell_sc_server_folder', undef),
472       dell_sc_volume_folder => hiera('cinder::backend::dellsc_iscsi::dell_sc_volume_folder', undef),
473     }
474   }
475
476   if hiera('cinder_enable_netapp_backend', false) {
477     $cinder_netapp_backend = hiera('cinder::backend::netapp::title')
478
479     if hiera('cinder::backend::netapp::nfs_shares', undef) {
480       $cinder_netapp_nfs_shares = split(hiera('cinder::backend::netapp::nfs_shares', undef), ',')
481     }
482
483     cinder::backend::netapp { $cinder_netapp_backend :
484       netapp_login                 => hiera('cinder::backend::netapp::netapp_login', undef),
485       netapp_password              => hiera('cinder::backend::netapp::netapp_password', undef),
486       netapp_server_hostname       => hiera('cinder::backend::netapp::netapp_server_hostname', undef),
487       netapp_server_port           => hiera('cinder::backend::netapp::netapp_server_port', undef),
488       netapp_size_multiplier       => hiera('cinder::backend::netapp::netapp_size_multiplier', undef),
489       netapp_storage_family        => hiera('cinder::backend::netapp::netapp_storage_family', undef),
490       netapp_storage_protocol      => hiera('cinder::backend::netapp::netapp_storage_protocol', undef),
491       netapp_transport_type        => hiera('cinder::backend::netapp::netapp_transport_type', undef),
492       netapp_vfiler                => hiera('cinder::backend::netapp::netapp_vfiler', undef),
493       netapp_volume_list           => hiera('cinder::backend::netapp::netapp_volume_list', undef),
494       netapp_vserver               => hiera('cinder::backend::netapp::netapp_vserver', undef),
495       netapp_partner_backend_name  => hiera('cinder::backend::netapp::netapp_partner_backend_name', undef),
496       nfs_shares                   => $cinder_netapp_nfs_shares,
497       nfs_shares_config            => hiera('cinder::backend::netapp::nfs_shares_config', undef),
498       netapp_copyoffload_tool_path => hiera('cinder::backend::netapp::netapp_copyoffload_tool_path', undef),
499       netapp_controller_ips        => hiera('cinder::backend::netapp::netapp_controller_ips', undef),
500       netapp_sa_password           => hiera('cinder::backend::netapp::netapp_sa_password', undef),
501       netapp_storage_pools         => hiera('cinder::backend::netapp::netapp_storage_pools', undef),
502       netapp_eseries_host_type     => hiera('cinder::backend::netapp::netapp_eseries_host_type', undef),
503       netapp_webservice_path       => hiera('cinder::backend::netapp::netapp_webservice_path', undef),
504     }
505   }
506
507   if hiera('cinder_enable_nfs_backend', false) {
508     $cinder_nfs_backend = 'tripleo_nfs'
509
510     if str2bool($::selinux) {
511       selboolean { 'virt_use_nfs':
512         value      => on,
513         persistent => true,
514       } -> Package['nfs-utils']
515     }
516
517     package {'nfs-utils': } ->
518     cinder::backend::nfs { $cinder_nfs_backend :
519       nfs_servers       => hiera('cinder_nfs_servers'),
520       nfs_mount_options => hiera('cinder_nfs_mount_options',''),
521       nfs_shares_config => '/etc/cinder/shares-nfs.conf',
522     }
523   }
524
525   $cinder_enabled_backends = delete_undef_values([$cinder_iscsi_backend, $cinder_rbd_backend, $cinder_eqlx_backend, $cinder_dellsc_backend, $cinder_netapp_backend, $cinder_nfs_backend])
526   class { '::cinder::backends' :
527     enabled_backends => union($cinder_enabled_backends, hiera('cinder_user_enabled_backends')),
528   }
529
530   # swift proxy
531   include ::memcached
532   include ::swift::proxy
533   include ::swift::proxy::proxy_logging
534   include ::swift::proxy::healthcheck
535   include ::swift::proxy::cache
536   include ::swift::proxy::keystone
537   include ::swift::proxy::authtoken
538   include ::swift::proxy::staticweb
539   include ::swift::proxy::ratelimit
540   include ::swift::proxy::catch_errors
541   include ::swift::proxy::tempurl
542   include ::swift::proxy::formpost
543
544   # swift storage
545   if str2bool(hiera('enable_swift_storage', true)) {
546     class { '::swift::storage::all':
547       mount_check => str2bool(hiera('swift_mount_check')),
548     }
549     if(!defined(File['/srv/node'])) {
550       file { '/srv/node':
551         ensure  => directory,
552         owner   => 'swift',
553         group   => 'swift',
554         require => Package['openstack-swift'],
555       }
556     }
557     $swift_components = ['account', 'container', 'object']
558     swift::storage::filter::recon { $swift_components : }
559     swift::storage::filter::healthcheck { $swift_components : }
560   }
561
562   # Ceilometer
563   $ceilometer_backend = downcase(hiera('ceilometer_backend'))
564   case $ceilometer_backend {
565     /mysql/ : {
566       $ceilometer_database_connection = hiera('ceilometer_mysql_conn_string')
567     }
568     default : {
569       $ceilometer_database_connection = $ceilometer_mongodb_conn_string
570     }
571   }
572   include ::ceilometer
573   include ::ceilometer::config
574   include ::ceilometer::api
575   include ::ceilometer::agent::notification
576   include ::ceilometer::agent::central
577   include ::ceilometer::expirer
578   include ::ceilometer::collector
579   include ::ceilometer::agent::auth
580   class { '::ceilometer::db' :
581     database_connection => $ceilometer_database_connection,
582   }
583
584   Cron <| title == 'ceilometer-expirer' |> { command => "sleep $((\$(od -A n -t d -N 3 /dev/urandom) % 86400)) && ${::ceilometer::params::expirer_command}" }
585
586   # Aodh
587   class { '::aodh' :
588     database_connection => $ceilometer_database_connection,
589   }
590   include ::aodh::db::sync
591   # To manage the upgrade:
592   Exec['ceilometer-dbsync'] -> Exec['aodh-db-sync']
593   include ::aodh::auth
594   include ::aodh::api
595   include ::aodh::wsgi::apache
596   include ::aodh::evaluator
597   include ::aodh::notifier
598   include ::aodh::listener
599   include ::aodh::client
600
601   # Heat
602   class { '::heat' :
603     notification_driver => 'messaging',
604   }
605   include ::heat::config
606   include ::heat::api
607   include ::heat::api_cfn
608   include ::heat::api_cloudwatch
609   include ::heat::engine
610
611   # Sahara
612   include ::sahara
613   include ::sahara::service::api
614   include ::sahara::service::engine
615
616   # Horizon
617   if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') {
618     $_profile_support = 'cisco'
619   } else {
620     $_profile_support = 'None'
621   }
622   $neutron_options   = {'profile_support' => $_profile_support }
623
624   $memcached_ipv6 = hiera('memcached_ipv6', false)
625   if $memcached_ipv6 {
626     $horizon_memcached_servers = hiera('memcache_node_ips_v6', '[::1]')
627   } else {
628     $horizon_memcached_servers = hiera('memcache_node_ips', '127.0.0.1')
629   }
630
631   class { '::horizon':
632     cache_server_ip => $horizon_memcached_servers,
633     neutron_options => $neutron_options,
634   }
635
636   $snmpd_user = hiera('snmpd_readonly_user_name')
637   snmp::snmpv3_user { $snmpd_user:
638     authtype => 'MD5',
639     authpass => hiera('snmpd_readonly_user_password'),
640   }
641   class { '::snmp':
642     agentaddress => ['udp:161','udp6:[::1]:161'],
643     snmpd_config => [ join(['createUser ', hiera('snmpd_readonly_user_name'), ' MD5 "', hiera('snmpd_readonly_user_password'), '"']), join(['rouser ', hiera('snmpd_readonly_user_name')]), 'proc  cron', 'includeAllDisks  10%', 'master agentx', 'trapsink localhost public', 'iquerySecName internalUser', 'rouser internalUser', 'defaultMonitors yes', 'linkUpDownNotifications yes' ],
644   }
645
646   hiera_include('controller_classes')
647
648 } #END STEP 4
649
650 if hiera('step') >= 5 {
651   $nova_enable_db_purge = hiera('nova_enable_db_purge', true)
652   $cinder_enable_db_purge = hiera('cinder_enable_db_purge', true)
653   $heat_enable_db_purge = hiera('heat_enable_db_purge', true)
654
655   if $nova_enable_db_purge {
656     include ::nova::cron::archive_deleted_rows
657   }
658   if $cinder_enable_db_purge {
659     include ::cinder::cron::db_purge
660   }
661   if $heat_enable_db_purge {
662     include ::heat::cron::purge_deleted
663   }
664
665   if downcase(hiera('bootstrap_nodeid')) == $::hostname {
666     # Class ::heat::keystone::domain has to run on bootstrap node
667     # because it creates DB entities via API calls.
668     include ::heat::keystone::domain
669
670     Class['::keystone::roles::admin'] -> Class['::heat::keystone::domain']
671   } else {
672     # On non-bootstrap node we don't need to create Keystone resources again
673     class { '::heat::keystone::domain':
674       manage_domain => false,
675       manage_user   => false,
676       manage_role   => false,
677     }
678   }
679
680 } #END STEP 5
681
682 $package_manifest_name = join(['/var/lib/tripleo/installed-packages/overcloud_controller', hiera('step')])
683 package_manifest{$package_manifest_name: ensure => present}