Refactor HAproxy and VIP creation.
[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       rbd_pool        => hiera('cinder_rbd_pool_name'),
439       rbd_user        => hiera('ceph_client_user_name'),
440       rbd_secret_uuid => hiera('ceph::profile::params::fsid'),
441       require         => $cinder_pool_requires,
442     }
443   }
444
445   if hiera('cinder_enable_eqlx_backend', false) {
446     $cinder_eqlx_backend = hiera('cinder::backend::eqlx::volume_backend_name')
447
448     cinder::backend::eqlx { $cinder_eqlx_backend :
449       volume_backend_name => hiera('cinder::backend::eqlx::volume_backend_name', undef),
450       san_ip              => hiera('cinder::backend::eqlx::san_ip', undef),
451       san_login           => hiera('cinder::backend::eqlx::san_login', undef),
452       san_password        => hiera('cinder::backend::eqlx::san_password', undef),
453       san_thin_provision  => hiera('cinder::backend::eqlx::san_thin_provision', undef),
454       eqlx_group_name     => hiera('cinder::backend::eqlx::eqlx_group_name', undef),
455       eqlx_pool           => hiera('cinder::backend::eqlx::eqlx_pool', undef),
456       eqlx_use_chap       => hiera('cinder::backend::eqlx::eqlx_use_chap', undef),
457       eqlx_chap_login     => hiera('cinder::backend::eqlx::eqlx_chap_login', undef),
458       eqlx_chap_password  => hiera('cinder::backend::eqlx::eqlx_san_password', undef),
459     }
460   }
461
462   if hiera('cinder_enable_dellsc_backend', false) {
463     $cinder_dellsc_backend = hiera('cinder::backend::dellsc_iscsi::volume_backend_name')
464
465     cinder::backend::dellsc_iscsi{ $cinder_dellsc_backend :
466       volume_backend_name   => hiera('cinder::backend::dellsc_iscsi::volume_backend_name', undef),
467       san_ip                => hiera('cinder::backend::dellsc_iscsi::san_ip', undef),
468       san_login             => hiera('cinder::backend::dellsc_iscsi::san_login', undef),
469       san_password          => hiera('cinder::backend::dellsc_iscsi::san_password', undef),
470       dell_sc_ssn           => hiera('cinder::backend::dellsc_iscsi::dell_sc_ssn', undef),
471       iscsi_ip_address      => hiera('cinder::backend::dellsc_iscsi::iscsi_ip_address', undef),
472       iscsi_port            => hiera('cinder::backend::dellsc_iscsi::iscsi_port', undef),
473       dell_sc_api_port      => hiera('cinder::backend::dellsc_iscsi::dell_sc_api_port', undef),
474       dell_sc_server_folder => hiera('cinder::backend::dellsc_iscsi::dell_sc_server_folder', undef),
475       dell_sc_volume_folder => hiera('cinder::backend::dellsc_iscsi::dell_sc_volume_folder', undef),
476     }
477   }
478
479   if hiera('cinder_enable_netapp_backend', false) {
480     $cinder_netapp_backend = hiera('cinder::backend::netapp::title')
481
482     if hiera('cinder::backend::netapp::nfs_shares', undef) {
483       $cinder_netapp_nfs_shares = split(hiera('cinder::backend::netapp::nfs_shares', undef), ',')
484     }
485
486     cinder::backend::netapp { $cinder_netapp_backend :
487       netapp_login                 => hiera('cinder::backend::netapp::netapp_login', undef),
488       netapp_password              => hiera('cinder::backend::netapp::netapp_password', undef),
489       netapp_server_hostname       => hiera('cinder::backend::netapp::netapp_server_hostname', undef),
490       netapp_server_port           => hiera('cinder::backend::netapp::netapp_server_port', undef),
491       netapp_size_multiplier       => hiera('cinder::backend::netapp::netapp_size_multiplier', undef),
492       netapp_storage_family        => hiera('cinder::backend::netapp::netapp_storage_family', undef),
493       netapp_storage_protocol      => hiera('cinder::backend::netapp::netapp_storage_protocol', undef),
494       netapp_transport_type        => hiera('cinder::backend::netapp::netapp_transport_type', undef),
495       netapp_vfiler                => hiera('cinder::backend::netapp::netapp_vfiler', undef),
496       netapp_volume_list           => hiera('cinder::backend::netapp::netapp_volume_list', undef),
497       netapp_vserver               => hiera('cinder::backend::netapp::netapp_vserver', undef),
498       netapp_partner_backend_name  => hiera('cinder::backend::netapp::netapp_partner_backend_name', undef),
499       nfs_shares                   => $cinder_netapp_nfs_shares,
500       nfs_shares_config            => hiera('cinder::backend::netapp::nfs_shares_config', undef),
501       netapp_copyoffload_tool_path => hiera('cinder::backend::netapp::netapp_copyoffload_tool_path', undef),
502       netapp_controller_ips        => hiera('cinder::backend::netapp::netapp_controller_ips', undef),
503       netapp_sa_password           => hiera('cinder::backend::netapp::netapp_sa_password', undef),
504       netapp_storage_pools         => hiera('cinder::backend::netapp::netapp_storage_pools', undef),
505       netapp_eseries_host_type     => hiera('cinder::backend::netapp::netapp_eseries_host_type', undef),
506       netapp_webservice_path       => hiera('cinder::backend::netapp::netapp_webservice_path', undef),
507     }
508   }
509
510   if hiera('cinder_enable_nfs_backend', false) {
511     $cinder_nfs_backend = 'tripleo_nfs'
512
513     if str2bool($::selinux) {
514       selboolean { 'virt_use_nfs':
515         value      => on,
516         persistent => true,
517       } -> Package['nfs-utils']
518     }
519
520     package {'nfs-utils': } ->
521     cinder::backend::nfs { $cinder_nfs_backend :
522       nfs_servers       => hiera('cinder_nfs_servers'),
523       nfs_mount_options => hiera('cinder_nfs_mount_options',''),
524       nfs_shares_config => '/etc/cinder/shares-nfs.conf',
525     }
526   }
527
528   $cinder_enabled_backends = delete_undef_values([$cinder_iscsi_backend, $cinder_rbd_backend, $cinder_eqlx_backend, $cinder_dellsc_backend, $cinder_netapp_backend, $cinder_nfs_backend])
529   class { '::cinder::backends' :
530     enabled_backends => union($cinder_enabled_backends, hiera('cinder_user_enabled_backends')),
531   }
532
533   # swift proxy
534   include ::memcached
535   include ::swift::proxy
536   include ::swift::proxy::proxy_logging
537   include ::swift::proxy::healthcheck
538   include ::swift::proxy::cache
539   include ::swift::proxy::keystone
540   include ::swift::proxy::authtoken
541   include ::swift::proxy::staticweb
542   include ::swift::proxy::ratelimit
543   include ::swift::proxy::catch_errors
544   include ::swift::proxy::tempurl
545   include ::swift::proxy::formpost
546
547   # swift storage
548   if str2bool(hiera('enable_swift_storage', true)) {
549     class { '::swift::storage::all':
550       mount_check => str2bool(hiera('swift_mount_check')),
551     }
552     if(!defined(File['/srv/node'])) {
553       file { '/srv/node':
554         ensure  => directory,
555         owner   => 'swift',
556         group   => 'swift',
557         require => Package['openstack-swift'],
558       }
559     }
560     $swift_components = ['account', 'container', 'object']
561     swift::storage::filter::recon { $swift_components : }
562     swift::storage::filter::healthcheck { $swift_components : }
563   }
564
565   # Ceilometer
566   $ceilometer_backend = downcase(hiera('ceilometer_backend'))
567   case $ceilometer_backend {
568     /mysql/ : {
569       $ceilometer_database_connection = hiera('ceilometer_mysql_conn_string')
570     }
571     default : {
572       $ceilometer_database_connection = $ceilometer_mongodb_conn_string
573     }
574   }
575   include ::ceilometer
576   include ::ceilometer::config
577   include ::ceilometer::api
578   include ::ceilometer::agent::notification
579   include ::ceilometer::agent::central
580   include ::ceilometer::expirer
581   include ::ceilometer::collector
582   include ::ceilometer::agent::auth
583   include ::ceilometer::dispatcher::gnocchi
584   class { '::ceilometer::db' :
585     database_connection => $ceilometer_database_connection,
586   }
587
588   Cron <| title == 'ceilometer-expirer' |> { command => "sleep $((\$(od -A n -t d -N 3 /dev/urandom) % 86400)) && ${::ceilometer::params::expirer_command}" }
589
590   # Aodh
591   class { '::aodh' :
592     database_connection => $ceilometer_database_connection,
593   }
594   include ::aodh::db::sync
595   # To manage the upgrade:
596   Exec['ceilometer-dbsync'] -> Exec['aodh-db-sync']
597   include ::aodh::auth
598   include ::aodh::api
599   include ::aodh::wsgi::apache
600   include ::aodh::evaluator
601   include ::aodh::notifier
602   include ::aodh::listener
603   include ::aodh::client
604
605   # Heat
606   class { '::heat' :
607     notification_driver => 'messaging',
608   }
609   include ::heat::config
610   include ::heat::api
611   include ::heat::api_cfn
612   include ::heat::api_cloudwatch
613   include ::heat::engine
614
615   # Sahara
616   include ::sahara
617   include ::sahara::service::api
618   include ::sahara::service::engine
619
620   # Horizon
621   if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') {
622     $_profile_support = 'cisco'
623   } else {
624     $_profile_support = 'None'
625   }
626   $neutron_options   = {'profile_support' => $_profile_support }
627
628   $memcached_ipv6 = hiera('memcached_ipv6', false)
629   if $memcached_ipv6 {
630     $horizon_memcached_servers = hiera('memcache_node_ips_v6', '[::1]')
631   } else {
632     $horizon_memcached_servers = hiera('memcache_node_ips', '127.0.0.1')
633   }
634
635   class { '::horizon':
636     cache_server_ip => $horizon_memcached_servers,
637     neutron_options => $neutron_options,
638   }
639
640   # Gnocchi
641   $gnocchi_database_connection = hiera('gnocchi_mysql_conn_string')
642   class { '::gnocchi':
643     database_connection => $gnocchi_database_connection,
644   }
645   include ::gnocchi::api
646   include ::gnocchi::wsgi::apache
647   include ::gnocchi::client
648   include ::gnocchi::db::sync
649   include ::gnocchi::storage
650   include ::gnocchi::metricd
651   include ::gnocchi::statsd
652   $gnocchi_backend = downcase(hiera('gnocchi_backend', 'swift'))
653   case $gnocchi_backend {
654       'swift': { include ::gnocchi::storage::swift }
655       'file': { include ::gnocchi::storage::file }
656       'rbd': { include ::gnocchi::storage::ceph }
657       default: { fail('Unrecognized gnocchi_backend parameter.') }
658   }
659
660   $snmpd_user = hiera('snmpd_readonly_user_name')
661   snmp::snmpv3_user { $snmpd_user:
662     authtype => 'MD5',
663     authpass => hiera('snmpd_readonly_user_password'),
664   }
665   class { '::snmp':
666     agentaddress => ['udp:161','udp6:[::1]:161'],
667     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' ],
668   }
669
670   hiera_include('controller_classes')
671
672 } #END STEP 4
673
674 if hiera('step') >= 5 {
675   $nova_enable_db_purge = hiera('nova_enable_db_purge', true)
676   $cinder_enable_db_purge = hiera('cinder_enable_db_purge', true)
677   $heat_enable_db_purge = hiera('heat_enable_db_purge', true)
678
679   if $nova_enable_db_purge {
680     include ::nova::cron::archive_deleted_rows
681   }
682   if $cinder_enable_db_purge {
683     include ::cinder::cron::db_purge
684   }
685   if $heat_enable_db_purge {
686     include ::heat::cron::purge_deleted
687   }
688
689   if downcase(hiera('bootstrap_nodeid')) == $::hostname {
690     # Class ::heat::keystone::domain has to run on bootstrap node
691     # because it creates DB entities via API calls.
692     include ::heat::keystone::domain
693
694     Class['::keystone::roles::admin'] -> Class['::heat::keystone::domain']
695   } else {
696     # On non-bootstrap node we don't need to create Keystone resources again
697     class { '::heat::keystone::domain':
698       manage_domain => false,
699       manage_user   => false,
700       manage_role   => false,
701     }
702   }
703
704 } #END STEP 5
705
706 $package_manifest_name = join(['/var/lib/tripleo/installed-packages/overcloud_controller', hiera('step')])
707 package_manifest{$package_manifest_name: ensure => present}