Keep setting backend_host to 'hostgroup' for rbd backends
[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('gnocchi_indexer_backend')) == 'mysql' {
125     include ::gnocchi::db::mysql
126   }
127   if downcase(hiera('ceilometer_backend')) == 'mysql' {
128     include ::ceilometer::db::mysql
129     include ::aodh::db::mysql
130   }
131
132   $rabbit_nodes = hiera('rabbit_node_ips')
133   if count($rabbit_nodes) > 1 {
134
135     $rabbit_ipv6 = str2bool(hiera('rabbit_ipv6', false))
136     if $rabbit_ipv6 {
137       $rabbit_env = merge(hiera('rabbitmq_environment'), {
138         'RABBITMQ_SERVER_START_ARGS' => '"-proto_dist inet6_tcp"'
139       })
140     } else {
141       $rabbit_env = hiera('rabbitmq_environment')
142     }
143
144     class { '::rabbitmq':
145       config_cluster          => true,
146       cluster_nodes           => $rabbit_nodes,
147       tcp_keepalive           => false,
148       config_kernel_variables => hiera('rabbitmq_kernel_variables'),
149       config_variables        => hiera('rabbitmq_config_variables'),
150       environment_variables   => $rabbit_env,
151     }
152     rabbitmq_policy { 'ha-all@/':
153       pattern    => '^(?!amq\.).*',
154       definition => {
155         'ha-mode' => 'all',
156       },
157     }
158   } else {
159     include ::rabbitmq
160   }
161
162   # pre-install swift here so we can build rings
163   include ::swift
164
165   $enable_ceph = hiera('ceph_storage_count', 0) > 0 or hiera('enable_ceph_storage', false)
166
167   if $enable_ceph {
168     $mon_initial_members = downcase(hiera('ceph_mon_initial_members'))
169     if str2bool(hiera('ceph_ipv6', false)) {
170       $mon_host = hiera('ceph_mon_host_v6')
171     } else {
172       $mon_host = hiera('ceph_mon_host')
173     }
174     class { '::ceph::profile::params':
175       mon_initial_members => $mon_initial_members,
176       mon_host            => $mon_host,
177     }
178     include ::ceph::conf
179     include ::ceph::profile::mon
180   }
181
182   if str2bool(hiera('enable_ceph_storage', false)) {
183     if str2bool(hiera('ceph_osd_selinux_permissive', true)) {
184       exec { 'set selinux to permissive on boot':
185         command => "sed -ie 's/^SELINUX=.*/SELINUX=permissive/' /etc/selinux/config",
186         onlyif  => "test -f /etc/selinux/config && ! grep '^SELINUX=permissive' /etc/selinux/config",
187         path    => ['/usr/bin', '/usr/sbin'],
188       }
189
190       exec { 'set selinux to permissive':
191         command => 'setenforce 0',
192         onlyif  => "which setenforce && getenforce | grep -i 'enforcing'",
193         path    => ['/usr/bin', '/usr/sbin'],
194       } -> Class['ceph::profile::osd']
195     }
196
197     include ::ceph::conf
198     include ::ceph::profile::osd
199   }
200
201   if str2bool(hiera('enable_external_ceph', false)) {
202     if str2bool(hiera('ceph_ipv6', false)) {
203       $mon_host = hiera('ceph_mon_host_v6')
204     } else {
205       $mon_host = hiera('ceph_mon_host')
206     }
207     class { '::ceph::profile::params':
208       mon_host            => $mon_host,
209     }
210     include ::ceph::conf
211     include ::ceph::profile::client
212   }
213
214 } #END STEP 2
215
216 if hiera('step') >= 4 {
217
218   $glance_backend = downcase(hiera('glance_backend', 'swift'))
219   case $glance_backend {
220       'swift': { $backend_store = 'glance.store.swift.Store' }
221       'file': { $backend_store = 'glance.store.filesystem.Store' }
222       'rbd': { $backend_store = 'glance.store.rbd.Store' }
223       default: { fail('Unrecognized glance_backend parameter.') }
224   }
225   $http_store = ['glance.store.http.Store']
226   $glance_store = concat($http_store, $backend_store)
227
228   # TODO: scrubber and other additional optional features
229   include ::glance
230   include ::glance::config
231   class { '::glance::api':
232     known_stores => $glance_store,
233   }
234   include ::glance::registry
235   include ::glance::notify::rabbitmq
236   include join(['::glance::backend::', $glance_backend])
237
238   $nova_ipv6 = hiera('nova::use_ipv6', false)
239   if $nova_ipv6 {
240     $memcached_servers = suffix(hiera('memcache_node_ips_v6'), ':11211')
241   } else {
242     $memcached_servers = suffix(hiera('memcache_node_ips'), ':11211')
243   }
244
245   class { '::nova' :
246     memcached_servers => $memcached_servers
247   }
248   include ::nova::config
249   include ::nova::api
250   include ::nova::cert
251   include ::nova::conductor
252   include ::nova::consoleauth
253   include ::nova::network::neutron
254   include ::nova::vncproxy
255   include ::nova::scheduler
256   include ::nova::scheduler::filter
257
258   if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
259
260     # TODO(devvesa) provide non-controller ips for these services
261     $zookeeper_node_ips = hiera('neutron_api_node_ips')
262     $cassandra_node_ips = hiera('neutron_api_node_ips')
263
264     # Run zookeeper in the controller if configured
265     if hiera('enable_zookeeper_on_controller') {
266       class {'::tripleo::cluster::zookeeper':
267         zookeeper_server_ips => $zookeeper_node_ips,
268         # TODO: create a 'bind' hiera key for zookeeper
269         zookeeper_client_ip  => hiera('neutron::bind_host'),
270         zookeeper_hostnames  => hiera('controller_node_names')
271       }
272     }
273
274     # Run cassandra in the controller if configured
275     if hiera('enable_cassandra_on_controller') {
276       class {'::tripleo::cluster::cassandra':
277         cassandra_servers => $cassandra_node_ips,
278         # TODO: create a 'bind' hiera key for cassandra
279         cassandra_ip      => hiera('neutron::bind_host'),
280       }
281     }
282
283     class {'::tripleo::network::midonet::agent':
284       zookeeper_servers => $zookeeper_node_ips,
285       cassandra_seeds   => $cassandra_node_ips
286     }
287
288     class {'::tripleo::network::midonet::api':
289       zookeeper_servers    => $zookeeper_node_ips,
290       vip                  => hiera('tripleo::loadbalancer::public_virtual_ip'),
291       keystone_ip          => hiera('tripleo::loadbalancer::public_virtual_ip'),
292       keystone_admin_token => hiera('keystone::admin_token'),
293       # TODO: create a 'bind' hiera key for api
294       bind_address         => hiera('neutron::bind_host'),
295       admin_password       => hiera('admin_password')
296     }
297
298     # TODO: find a way to get an empty list from hiera
299     class {'::neutron':
300       service_plugins => []
301     }
302
303   }
304   else {
305
306     # ML2 plugin
307     include ::neutron
308   }
309
310   include ::neutron::config
311   include ::neutron::server
312   include ::neutron::server::notifications
313
314   # If the value of core plugin is set to 'nuage' or'opencontrail' or 'plumgrid',
315   # include nuage or opencontrail or plumgrid core plugins
316   # else use the default value of 'ml2'
317   if hiera('neutron::core_plugin') == 'neutron.plugins.nuage.plugin.NuagePlugin' {
318     include ::neutron::plugins::nuage
319   } elsif hiera('neutron::core_plugin') == 'neutron_plugin_contrail.plugins.opencontrail.contrail_plugin.NeutronPluginContrailCoreV2' {
320     include ::neutron::plugins::opencontrail
321   }
322   elsif hiera('neutron::core_plugin') == 'networking_plumgrid.neutron.plugins.plugin.NeutronPluginPLUMgridV2' {
323     class { '::neutron::plugins::plumgrid' :
324       connection                   => hiera('neutron::server::database_connection'),
325       controller_priv_host         => hiera('keystone_admin_api_vip'),
326       admin_password               => hiera('admin_password'),
327       metadata_proxy_shared_secret => hiera('nova::api::neutron_metadata_proxy_shared_secret'),
328     }
329   } else {
330     include ::neutron::agents::l3
331     include ::neutron::agents::dhcp
332     include ::neutron::agents::metadata
333
334     file { '/etc/neutron/dnsmasq-neutron.conf':
335       content => hiera('neutron_dnsmasq_options'),
336       owner   => 'neutron',
337       group   => 'neutron',
338       notify  => Service['neutron-dhcp-service'],
339       require => Package['neutron'],
340     }
341
342     # If the value of core plugin is set to 'midonet',
343     # skip all the ML2 configuration
344     if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
345
346       class {'::neutron::plugins::midonet':
347         midonet_api_ip    => hiera('tripleo::loadbalancer::public_virtual_ip'),
348         keystone_tenant   => hiera('neutron::server::auth_tenant'),
349         keystone_password => hiera('neutron::server::auth_password')
350       }
351     } else {
352
353       include ::neutron::plugins::ml2
354       include ::neutron::agents::ml2::ovs
355
356       if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') {
357         include ::neutron::plugins::ml2::cisco::nexus1000v
358
359         class { '::neutron::agents::n1kv_vem':
360           n1kv_source  => hiera('n1kv_vem_source', undef),
361           n1kv_version => hiera('n1kv_vem_version', undef),
362         }
363
364         class { '::n1k_vsm':
365           n1kv_source       => hiera('n1kv_vsm_source', undef),
366           n1kv_version      => hiera('n1kv_vsm_version', undef),
367           pacemaker_control => false,
368         }
369       }
370
371       if 'cisco_ucsm' in hiera('neutron::plugins::ml2::mechanism_drivers') {
372         include ::neutron::plugins::ml2::cisco::ucsm
373       }
374       if 'cisco_nexus' in hiera('neutron::plugins::ml2::mechanism_drivers') {
375         include ::neutron::plugins::ml2::cisco::nexus
376         include ::neutron::plugins::ml2::cisco::type_nexus_vxlan
377       }
378
379       if 'bsn_ml2' in hiera('neutron::plugins::ml2::mechanism_drivers') {
380         include ::neutron::plugins::ml2::bigswitch::restproxy
381         include ::neutron::agents::bigswitch
382       }
383       neutron_l3_agent_config {
384         'DEFAULT/ovs_use_veth': value => hiera('neutron_ovs_use_veth', false);
385       }
386       neutron_dhcp_agent_config {
387         'DEFAULT/ovs_use_veth': value => hiera('neutron_ovs_use_veth', false);
388       }
389       Service['neutron-server'] -> Service['neutron-ovs-agent-service']
390     }
391
392     Service['neutron-server'] -> Service['neutron-dhcp-service']
393     Service['neutron-server'] -> Service['neutron-l3']
394     Service['neutron-server'] -> Service['neutron-metadata']
395   }
396
397   include ::cinder
398   include ::cinder::config
399   include ::tripleo::ssl::cinder_config
400   include ::cinder::api
401   include ::cinder::glance
402   include ::cinder::scheduler
403   include ::cinder::volume
404   include ::cinder::ceilometer
405   class { '::cinder::setup_test_volume':
406     size => join([hiera('cinder_lvm_loop_device_size'), 'M']),
407   }
408
409   $cinder_enable_iscsi = hiera('cinder_enable_iscsi_backend', true)
410   if $cinder_enable_iscsi {
411     $cinder_iscsi_backend = 'tripleo_iscsi'
412
413     cinder::backend::iscsi { $cinder_iscsi_backend :
414       iscsi_ip_address => hiera('cinder_iscsi_ip_address'),
415       iscsi_helper     => hiera('cinder_iscsi_helper'),
416     }
417   }
418
419   if $enable_ceph {
420
421     $ceph_pools = hiera('ceph_pools')
422     ceph::pool { $ceph_pools :
423       pg_num  => hiera('ceph::profile::params::osd_pool_default_pg_num'),
424       pgp_num => hiera('ceph::profile::params::osd_pool_default_pgp_num'),
425       size    => hiera('ceph::profile::params::osd_pool_default_size'),
426     }
427
428     $cinder_pool_requires = [Ceph::Pool[hiera('cinder_rbd_pool_name')]]
429
430   } else {
431     $cinder_pool_requires = []
432   }
433
434   if hiera('cinder_enable_rbd_backend', false) {
435     $cinder_rbd_backend = 'tripleo_ceph'
436
437     cinder::backend::rbd { $cinder_rbd_backend :
438       backend_host    => hiera('cinder::host'),
439       rbd_pool        => hiera('cinder_rbd_pool_name'),
440       rbd_user        => hiera('ceph_client_user_name'),
441       rbd_secret_uuid => hiera('ceph::profile::params::fsid'),
442       require         => $cinder_pool_requires,
443     }
444   }
445
446   if hiera('cinder_enable_eqlx_backend', false) {
447     $cinder_eqlx_backend = hiera('cinder::backend::eqlx::volume_backend_name')
448
449     cinder::backend::eqlx { $cinder_eqlx_backend :
450       volume_backend_name => hiera('cinder::backend::eqlx::volume_backend_name', undef),
451       san_ip              => hiera('cinder::backend::eqlx::san_ip', undef),
452       san_login           => hiera('cinder::backend::eqlx::san_login', undef),
453       san_password        => hiera('cinder::backend::eqlx::san_password', undef),
454       san_thin_provision  => hiera('cinder::backend::eqlx::san_thin_provision', undef),
455       eqlx_group_name     => hiera('cinder::backend::eqlx::eqlx_group_name', undef),
456       eqlx_pool           => hiera('cinder::backend::eqlx::eqlx_pool', undef),
457       eqlx_use_chap       => hiera('cinder::backend::eqlx::eqlx_use_chap', undef),
458       eqlx_chap_login     => hiera('cinder::backend::eqlx::eqlx_chap_login', undef),
459       eqlx_chap_password  => hiera('cinder::backend::eqlx::eqlx_san_password', undef),
460     }
461   }
462
463   if hiera('cinder_enable_dellsc_backend', false) {
464     $cinder_dellsc_backend = hiera('cinder::backend::dellsc_iscsi::volume_backend_name')
465
466     cinder::backend::dellsc_iscsi{ $cinder_dellsc_backend :
467       volume_backend_name   => hiera('cinder::backend::dellsc_iscsi::volume_backend_name', undef),
468       san_ip                => hiera('cinder::backend::dellsc_iscsi::san_ip', undef),
469       san_login             => hiera('cinder::backend::dellsc_iscsi::san_login', undef),
470       san_password          => hiera('cinder::backend::dellsc_iscsi::san_password', undef),
471       dell_sc_ssn           => hiera('cinder::backend::dellsc_iscsi::dell_sc_ssn', undef),
472       iscsi_ip_address      => hiera('cinder::backend::dellsc_iscsi::iscsi_ip_address', undef),
473       iscsi_port            => hiera('cinder::backend::dellsc_iscsi::iscsi_port', undef),
474       dell_sc_api_port      => hiera('cinder::backend::dellsc_iscsi::dell_sc_api_port', undef),
475       dell_sc_server_folder => hiera('cinder::backend::dellsc_iscsi::dell_sc_server_folder', undef),
476       dell_sc_volume_folder => hiera('cinder::backend::dellsc_iscsi::dell_sc_volume_folder', undef),
477     }
478   }
479
480   if hiera('cinder_enable_netapp_backend', false) {
481     $cinder_netapp_backend = hiera('cinder::backend::netapp::title')
482
483     if hiera('cinder::backend::netapp::nfs_shares', undef) {
484       $cinder_netapp_nfs_shares = split(hiera('cinder::backend::netapp::nfs_shares', undef), ',')
485     }
486
487     cinder::backend::netapp { $cinder_netapp_backend :
488       netapp_login                 => hiera('cinder::backend::netapp::netapp_login', undef),
489       netapp_password              => hiera('cinder::backend::netapp::netapp_password', undef),
490       netapp_server_hostname       => hiera('cinder::backend::netapp::netapp_server_hostname', undef),
491       netapp_server_port           => hiera('cinder::backend::netapp::netapp_server_port', undef),
492       netapp_size_multiplier       => hiera('cinder::backend::netapp::netapp_size_multiplier', undef),
493       netapp_storage_family        => hiera('cinder::backend::netapp::netapp_storage_family', undef),
494       netapp_storage_protocol      => hiera('cinder::backend::netapp::netapp_storage_protocol', undef),
495       netapp_transport_type        => hiera('cinder::backend::netapp::netapp_transport_type', undef),
496       netapp_vfiler                => hiera('cinder::backend::netapp::netapp_vfiler', undef),
497       netapp_volume_list           => hiera('cinder::backend::netapp::netapp_volume_list', undef),
498       netapp_vserver               => hiera('cinder::backend::netapp::netapp_vserver', undef),
499       netapp_partner_backend_name  => hiera('cinder::backend::netapp::netapp_partner_backend_name', undef),
500       nfs_shares                   => $cinder_netapp_nfs_shares,
501       nfs_shares_config            => hiera('cinder::backend::netapp::nfs_shares_config', undef),
502       netapp_copyoffload_tool_path => hiera('cinder::backend::netapp::netapp_copyoffload_tool_path', undef),
503       netapp_controller_ips        => hiera('cinder::backend::netapp::netapp_controller_ips', undef),
504       netapp_sa_password           => hiera('cinder::backend::netapp::netapp_sa_password', undef),
505       netapp_storage_pools         => hiera('cinder::backend::netapp::netapp_storage_pools', undef),
506       netapp_eseries_host_type     => hiera('cinder::backend::netapp::netapp_eseries_host_type', undef),
507       netapp_webservice_path       => hiera('cinder::backend::netapp::netapp_webservice_path', undef),
508     }
509   }
510
511   if hiera('cinder_enable_nfs_backend', false) {
512     $cinder_nfs_backend = 'tripleo_nfs'
513
514     if str2bool($::selinux) {
515       selboolean { 'virt_use_nfs':
516         value      => on,
517         persistent => true,
518       } -> Package['nfs-utils']
519     }
520
521     package {'nfs-utils': } ->
522     cinder::backend::nfs { $cinder_nfs_backend :
523       nfs_servers       => hiera('cinder_nfs_servers'),
524       nfs_mount_options => hiera('cinder_nfs_mount_options',''),
525       nfs_shares_config => '/etc/cinder/shares-nfs.conf',
526     }
527   }
528
529   $cinder_enabled_backends = delete_undef_values([$cinder_iscsi_backend, $cinder_rbd_backend, $cinder_eqlx_backend, $cinder_dellsc_backend, $cinder_netapp_backend, $cinder_nfs_backend])
530   class { '::cinder::backends' :
531     enabled_backends => union($cinder_enabled_backends, hiera('cinder_user_enabled_backends')),
532   }
533
534   # swift proxy
535   include ::memcached
536   include ::swift::proxy
537   include ::swift::proxy::proxy_logging
538   include ::swift::proxy::healthcheck
539   include ::swift::proxy::cache
540   include ::swift::proxy::keystone
541   include ::swift::proxy::authtoken
542   include ::swift::proxy::staticweb
543   include ::swift::proxy::ratelimit
544   include ::swift::proxy::catch_errors
545   include ::swift::proxy::tempurl
546   include ::swift::proxy::formpost
547
548   # swift storage
549   if str2bool(hiera('enable_swift_storage', true)) {
550     class { '::swift::storage::all':
551       mount_check => str2bool(hiera('swift_mount_check')),
552     }
553     if(!defined(File['/srv/node'])) {
554       file { '/srv/node':
555         ensure  => directory,
556         owner   => 'swift',
557         group   => 'swift',
558         require => Package['openstack-swift'],
559       }
560     }
561     $swift_components = ['account', 'container', 'object']
562     swift::storage::filter::recon { $swift_components : }
563     swift::storage::filter::healthcheck { $swift_components : }
564   }
565
566   # Ceilometer
567   $ceilometer_backend = downcase(hiera('ceilometer_backend'))
568   case $ceilometer_backend {
569     /mysql/ : {
570       $ceilometer_database_connection = hiera('ceilometer_mysql_conn_string')
571     }
572     default : {
573       $ceilometer_database_connection = $ceilometer_mongodb_conn_string
574     }
575   }
576   include ::ceilometer
577   include ::ceilometer::config
578   include ::ceilometer::api
579   include ::ceilometer::agent::notification
580   include ::ceilometer::agent::central
581   include ::ceilometer::expirer
582   include ::ceilometer::collector
583   include ::ceilometer::agent::auth
584   include ::ceilometer::dispatcher::gnocchi
585   class { '::ceilometer::db' :
586     database_connection => $ceilometer_database_connection,
587   }
588
589   Cron <| title == 'ceilometer-expirer' |> { command => "sleep $((\$(od -A n -t d -N 3 /dev/urandom) % 86400)) && ${::ceilometer::params::expirer_command}" }
590
591   # Aodh
592   class { '::aodh' :
593     database_connection => $ceilometer_database_connection,
594   }
595   include ::aodh::db::sync
596   # To manage the upgrade:
597   Exec['ceilometer-dbsync'] -> Exec['aodh-db-sync']
598   include ::aodh::auth
599   include ::aodh::api
600   include ::aodh::wsgi::apache
601   include ::aodh::evaluator
602   include ::aodh::notifier
603   include ::aodh::listener
604   include ::aodh::client
605
606   # Heat
607   class { '::heat' :
608     notification_driver => 'messaging',
609   }
610   include ::heat::config
611   include ::heat::api
612   include ::heat::api_cfn
613   include ::heat::api_cloudwatch
614   include ::heat::engine
615
616   # Sahara
617   include ::sahara
618   include ::sahara::service::api
619   include ::sahara::service::engine
620
621   # Horizon
622   if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') {
623     $_profile_support = 'cisco'
624   } else {
625     $_profile_support = 'None'
626   }
627   $neutron_options   = {'profile_support' => $_profile_support }
628
629   $memcached_ipv6 = hiera('memcached_ipv6', false)
630   if $memcached_ipv6 {
631     $horizon_memcached_servers = hiera('memcache_node_ips_v6', '[::1]')
632   } else {
633     $horizon_memcached_servers = hiera('memcache_node_ips', '127.0.0.1')
634   }
635
636   class { '::horizon':
637     cache_server_ip => $horizon_memcached_servers,
638     neutron_options => $neutron_options,
639   }
640
641   # Gnocchi
642   $gnocchi_database_connection = hiera('gnocchi_mysql_conn_string')
643   class { '::gnocchi':
644     database_connection => $gnocchi_database_connection,
645   }
646   include ::gnocchi::api
647   include ::gnocchi::wsgi::apache
648   include ::gnocchi::client
649   include ::gnocchi::db::sync
650   include ::gnocchi::storage
651   include ::gnocchi::metricd
652   include ::gnocchi::statsd
653   $gnocchi_backend = downcase(hiera('gnocchi_backend', 'swift'))
654   case $gnocchi_backend {
655       'swift': { include ::gnocchi::storage::swift }
656       'file': { include ::gnocchi::storage::file }
657       'rbd': { include ::gnocchi::storage::ceph }
658       default: { fail('Unrecognized gnocchi_backend parameter.') }
659   }
660
661   $snmpd_user = hiera('snmpd_readonly_user_name')
662   snmp::snmpv3_user { $snmpd_user:
663     authtype => 'MD5',
664     authpass => hiera('snmpd_readonly_user_password'),
665   }
666   class { '::snmp':
667     agentaddress => ['udp:161','udp6:[::1]:161'],
668     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' ],
669   }
670
671   hiera_include('controller_classes')
672
673 } #END STEP 4
674
675 if hiera('step') >= 5 {
676   $nova_enable_db_purge = hiera('nova_enable_db_purge', true)
677   $cinder_enable_db_purge = hiera('cinder_enable_db_purge', true)
678   $heat_enable_db_purge = hiera('heat_enable_db_purge', true)
679
680   if $nova_enable_db_purge {
681     include ::nova::cron::archive_deleted_rows
682   }
683   if $cinder_enable_db_purge {
684     include ::cinder::cron::db_purge
685   }
686   if $heat_enable_db_purge {
687     include ::heat::cron::purge_deleted
688   }
689
690   if downcase(hiera('bootstrap_nodeid')) == $::hostname {
691     # Class ::heat::keystone::domain has to run on bootstrap node
692     # because it creates DB entities via API calls.
693     include ::heat::keystone::domain
694
695     Class['::keystone::roles::admin'] -> Class['::heat::keystone::domain']
696   } else {
697     # On non-bootstrap node we don't need to create Keystone resources again
698     class { '::heat::keystone::domain':
699       manage_domain => false,
700       manage_user   => false,
701       manage_role   => false,
702     }
703   }
704
705 } #END STEP 5
706
707 $package_manifest_name = join(['/var/lib/tripleo/installed-packages/overcloud_controller', hiera('step')])
708 package_manifest{$package_manifest_name: ensure => present}