1 # Copyright 2014 Red Hat, Inc.
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
8 # http://www.apache.org/licenses/LICENSE-2.0
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
16 include ::tripleo::packages
17 include ::tripleo::firewall
19 $enable_load_balancer = hiera('enable_load_balancer', true)
21 if hiera('step') >= 1 {
23 create_resources(kmod::load, hiera('kernel_modules'), {})
24 create_resources(sysctl::value, hiera('sysctl_settings'), {})
25 Exec <| tag == 'kmod::load' |> -> Sysctl <| |>
27 $controller_node_ips = split(hiera('controller_node_ips'), ',')
29 if $enable_load_balancer {
30 class { '::tripleo::loadbalancer' :
31 controller_hosts => $controller_node_ips,
38 if hiera('step') >= 2 {
40 if count(hiera('ntp::servers')) > 0 {
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'
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')
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')
62 $mongo_node_string = join($mongo_node_ips_with_port, ',')
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,
74 $redis_node_ips = hiera('redis_node_ips')
75 $redis_master_hostname = downcase(hiera('bootstrap_nodeid'))
77 if $redis_master_hostname == $::hostname {
80 $slaveof = "${redis_master_hostname} 6379"
86 if count($redis_node_ips) > 1 {
87 Class['::tripleo::redis_notification'] -> Service['redis-sentinel']
88 include ::redis::sentinel
89 include ::tripleo::redis_notification
92 if str2bool(hiera('enable_galera', true)) {
93 $mysql_config_file = '/etc/my.cnf.d/galera.cnf'
95 $mysql_config_file = '/etc/my.cnf.d/server.cnf'
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 => {
106 'bind-address' => $::hostname,
107 'max_connections' => hiera('mysql_max_connections'),
108 'open_files_limit' => '-1',
111 remove_default_accounts => true,
114 # FIXME: this should only occur on the bootstrap host (ditto for db syncs)
115 # Create all the database schemas
116 include ::nova::db::mysql
117 include ::nova::db::mysql_api
118 include ::neutron::db::mysql
119 include ::cinder::db::mysql
120 include ::sahara::db::mysql
121 if downcase(hiera('gnocchi_indexer_backend')) == 'mysql' {
122 include ::gnocchi::db::mysql
124 if downcase(hiera('ceilometer_backend')) == 'mysql' {
125 include ::ceilometer::db::mysql
126 include ::aodh::db::mysql
129 $rabbit_nodes = hiera('rabbit_node_ips')
130 if count($rabbit_nodes) > 1 {
132 $rabbit_ipv6 = str2bool(hiera('rabbit_ipv6', false))
134 $rabbit_env = merge(hiera('rabbitmq_environment'), {
135 'RABBITMQ_SERVER_START_ARGS' => '"-proto_dist inet6_tcp"'
138 $rabbit_env = hiera('rabbitmq_environment')
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,
149 rabbitmq_policy { 'ha-all@/':
150 pattern => '^(?!amq\.).*',
159 # pre-install swift here so we can build rings
162 $enable_ceph = hiera('ceph_storage_count', 0) > 0 or hiera('enable_ceph_storage', false)
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')
169 $mon_host = hiera('ceph_mon_host')
171 class { '::ceph::profile::params':
172 mon_initial_members => $mon_initial_members,
173 mon_host => $mon_host,
176 include ::ceph::profile::mon
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'],
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']
195 include ::ceph::profile::osd
198 if str2bool(hiera('enable_external_ceph', false)) {
199 if str2bool(hiera('ceph_ipv6', false)) {
200 $mon_host = hiera('ceph_mon_host_v6')
202 $mon_host = hiera('ceph_mon_host')
204 class { '::ceph::profile::params':
205 mon_host => $mon_host,
208 include ::ceph::profile::client
213 if hiera('step') >= 4 {
215 $nova_ipv6 = hiera('nova::use_ipv6', false)
217 $memcached_servers = suffix(hiera('memcache_node_ips_v6'), ':11211')
219 $memcached_servers = suffix(hiera('memcache_node_ips'), ':11211')
223 memcached_servers => $memcached_servers
225 include ::nova::config
228 include ::nova::conductor
229 include ::nova::consoleauth
230 include ::nova::network::neutron
231 include ::nova::vncproxy
232 include ::nova::scheduler
233 include ::nova::scheduler::filter
235 if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
237 # TODO(devvesa) provide non-controller ips for these services
238 $zookeeper_node_ips = hiera('neutron_api_node_ips')
239 $cassandra_node_ips = hiera('neutron_api_node_ips')
241 # Run zookeeper in the controller if configured
242 if hiera('enable_zookeeper_on_controller') {
243 class {'::tripleo::cluster::zookeeper':
244 zookeeper_server_ips => $zookeeper_node_ips,
245 # TODO: create a 'bind' hiera key for zookeeper
246 zookeeper_client_ip => hiera('neutron::bind_host'),
247 zookeeper_hostnames => hiera('controller_node_names')
251 # Run cassandra in the controller if configured
252 if hiera('enable_cassandra_on_controller') {
253 class {'::tripleo::cluster::cassandra':
254 cassandra_servers => $cassandra_node_ips,
255 # TODO: create a 'bind' hiera key for cassandra
256 cassandra_ip => hiera('neutron::bind_host'),
260 class {'::tripleo::network::midonet::agent':
261 zookeeper_servers => $zookeeper_node_ips,
262 cassandra_seeds => $cassandra_node_ips
265 class {'::tripleo::network::midonet::api':
266 zookeeper_servers => $zookeeper_node_ips,
267 vip => hiera('tripleo::loadbalancer::public_virtual_ip'),
268 keystone_ip => hiera('tripleo::loadbalancer::public_virtual_ip'),
269 keystone_admin_token => hiera('keystone::admin_token'),
270 # TODO: create a 'bind' hiera key for api
271 bind_address => hiera('neutron::bind_host'),
272 admin_password => hiera('admin_password')
275 # TODO: find a way to get an empty list from hiera
277 service_plugins => []
287 include ::neutron::config
288 include ::neutron::server
289 include ::neutron::server::notifications
291 # If the value of core plugin is set to 'nuage' or'opencontrail' or 'plumgrid',
292 # include nuage or opencontrail or plumgrid core plugins
293 # else use the default value of 'ml2'
294 if hiera('neutron::core_plugin') == 'neutron.plugins.nuage.plugin.NuagePlugin' {
295 include ::neutron::plugins::nuage
296 } elsif hiera('neutron::core_plugin') == 'neutron_plugin_contrail.plugins.opencontrail.contrail_plugin.NeutronPluginContrailCoreV2' {
297 include ::neutron::plugins::opencontrail
299 elsif hiera('neutron::core_plugin') == 'networking_plumgrid.neutron.plugins.plugin.NeutronPluginPLUMgridV2' {
300 class { '::neutron::plugins::plumgrid' :
301 connection => hiera('neutron::server::database_connection'),
302 controller_priv_host => hiera('keystone_admin_api_vip'),
303 admin_password => hiera('admin_password'),
304 metadata_proxy_shared_secret => hiera('nova::api::neutron_metadata_proxy_shared_secret'),
307 include ::neutron::agents::l3
308 include ::neutron::agents::metadata
310 # If the value of core plugin is set to 'midonet',
311 # skip all the ML2 configuration
312 if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
314 class {'::neutron::plugins::midonet':
315 midonet_api_ip => hiera('tripleo::loadbalancer::public_virtual_ip'),
316 keystone_tenant => hiera('neutron::server::auth_tenant'),
317 keystone_password => hiera('neutron::server::auth_password')
321 include ::neutron::plugins::ml2
322 include ::neutron::agents::ml2::ovs
324 if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') {
325 include ::neutron::plugins::ml2::cisco::nexus1000v
327 class { '::neutron::agents::n1kv_vem':
328 n1kv_source => hiera('n1kv_vem_source', undef),
329 n1kv_version => hiera('n1kv_vem_version', undef),
333 n1kv_source => hiera('n1kv_vsm_source', undef),
334 n1kv_version => hiera('n1kv_vsm_version', undef),
335 pacemaker_control => false,
339 if 'cisco_ucsm' in hiera('neutron::plugins::ml2::mechanism_drivers') {
340 include ::neutron::plugins::ml2::cisco::ucsm
342 if 'cisco_nexus' in hiera('neutron::plugins::ml2::mechanism_drivers') {
343 include ::neutron::plugins::ml2::cisco::nexus
344 include ::neutron::plugins::ml2::cisco::type_nexus_vxlan
347 if 'bsn_ml2' in hiera('neutron::plugins::ml2::mechanism_drivers') {
348 include ::neutron::plugins::ml2::bigswitch::restproxy
349 include ::neutron::agents::bigswitch
351 neutron_l3_agent_config {
352 'DEFAULT/ovs_use_veth': value => hiera('neutron_ovs_use_veth', false);
354 Service['neutron-server'] -> Service['neutron-ovs-agent-service']
357 Service['neutron-server'] -> Service['neutron-l3']
358 Service['neutron-server'] -> Service['neutron-metadata']
362 include ::cinder::config
363 include ::tripleo::ssl::cinder_config
364 include ::cinder::api
365 include ::cinder::glance
366 include ::cinder::scheduler
367 include ::cinder::volume
368 include ::cinder::ceilometer
369 class { '::cinder::setup_test_volume':
370 size => join([hiera('cinder_lvm_loop_device_size'), 'M']),
373 $cinder_enable_iscsi = hiera('cinder_enable_iscsi_backend', true)
374 if $cinder_enable_iscsi {
375 $cinder_iscsi_backend = 'tripleo_iscsi'
377 cinder::backend::iscsi { $cinder_iscsi_backend :
378 iscsi_ip_address => hiera('cinder_iscsi_ip_address'),
379 iscsi_helper => hiera('cinder_iscsi_helper'),
385 $ceph_pools = hiera('ceph_pools')
386 ceph::pool { $ceph_pools :
387 pg_num => hiera('ceph::profile::params::osd_pool_default_pg_num'),
388 pgp_num => hiera('ceph::profile::params::osd_pool_default_pgp_num'),
389 size => hiera('ceph::profile::params::osd_pool_default_size'),
392 $cinder_pool_requires = [Ceph::Pool[hiera('cinder_rbd_pool_name')]]
395 $cinder_pool_requires = []
398 if hiera('cinder_enable_rbd_backend', false) {
399 $cinder_rbd_backend = 'tripleo_ceph'
401 cinder::backend::rbd { $cinder_rbd_backend :
402 backend_host => hiera('cinder::host'),
403 rbd_pool => hiera('cinder_rbd_pool_name'),
404 rbd_user => hiera('ceph_client_user_name'),
405 rbd_secret_uuid => hiera('ceph::profile::params::fsid'),
406 require => $cinder_pool_requires,
410 if hiera('cinder_enable_eqlx_backend', false) {
411 $cinder_eqlx_backend = hiera('cinder::backend::eqlx::volume_backend_name')
413 cinder::backend::eqlx { $cinder_eqlx_backend :
414 volume_backend_name => hiera('cinder::backend::eqlx::volume_backend_name', undef),
415 san_ip => hiera('cinder::backend::eqlx::san_ip', undef),
416 san_login => hiera('cinder::backend::eqlx::san_login', undef),
417 san_password => hiera('cinder::backend::eqlx::san_password', undef),
418 san_thin_provision => hiera('cinder::backend::eqlx::san_thin_provision', undef),
419 eqlx_group_name => hiera('cinder::backend::eqlx::eqlx_group_name', undef),
420 eqlx_pool => hiera('cinder::backend::eqlx::eqlx_pool', undef),
421 eqlx_use_chap => hiera('cinder::backend::eqlx::eqlx_use_chap', undef),
422 eqlx_chap_login => hiera('cinder::backend::eqlx::eqlx_chap_login', undef),
423 eqlx_chap_password => hiera('cinder::backend::eqlx::eqlx_san_password', undef),
427 if hiera('cinder_enable_dellsc_backend', false) {
428 $cinder_dellsc_backend = hiera('cinder::backend::dellsc_iscsi::volume_backend_name')
430 cinder::backend::dellsc_iscsi{ $cinder_dellsc_backend :
431 volume_backend_name => hiera('cinder::backend::dellsc_iscsi::volume_backend_name', undef),
432 san_ip => hiera('cinder::backend::dellsc_iscsi::san_ip', undef),
433 san_login => hiera('cinder::backend::dellsc_iscsi::san_login', undef),
434 san_password => hiera('cinder::backend::dellsc_iscsi::san_password', undef),
435 dell_sc_ssn => hiera('cinder::backend::dellsc_iscsi::dell_sc_ssn', undef),
436 iscsi_ip_address => hiera('cinder::backend::dellsc_iscsi::iscsi_ip_address', undef),
437 iscsi_port => hiera('cinder::backend::dellsc_iscsi::iscsi_port', undef),
438 dell_sc_api_port => hiera('cinder::backend::dellsc_iscsi::dell_sc_api_port', undef),
439 dell_sc_server_folder => hiera('cinder::backend::dellsc_iscsi::dell_sc_server_folder', undef),
440 dell_sc_volume_folder => hiera('cinder::backend::dellsc_iscsi::dell_sc_volume_folder', undef),
444 if hiera('cinder_enable_netapp_backend', false) {
445 $cinder_netapp_backend = hiera('cinder::backend::netapp::title')
447 if hiera('cinder::backend::netapp::nfs_shares', undef) {
448 $cinder_netapp_nfs_shares = split(hiera('cinder::backend::netapp::nfs_shares', undef), ',')
451 cinder::backend::netapp { $cinder_netapp_backend :
452 netapp_login => hiera('cinder::backend::netapp::netapp_login', undef),
453 netapp_password => hiera('cinder::backend::netapp::netapp_password', undef),
454 netapp_server_hostname => hiera('cinder::backend::netapp::netapp_server_hostname', undef),
455 netapp_server_port => hiera('cinder::backend::netapp::netapp_server_port', undef),
456 netapp_size_multiplier => hiera('cinder::backend::netapp::netapp_size_multiplier', undef),
457 netapp_storage_family => hiera('cinder::backend::netapp::netapp_storage_family', undef),
458 netapp_storage_protocol => hiera('cinder::backend::netapp::netapp_storage_protocol', undef),
459 netapp_transport_type => hiera('cinder::backend::netapp::netapp_transport_type', undef),
460 netapp_vfiler => hiera('cinder::backend::netapp::netapp_vfiler', undef),
461 netapp_volume_list => hiera('cinder::backend::netapp::netapp_volume_list', undef),
462 netapp_vserver => hiera('cinder::backend::netapp::netapp_vserver', undef),
463 netapp_partner_backend_name => hiera('cinder::backend::netapp::netapp_partner_backend_name', undef),
464 nfs_shares => $cinder_netapp_nfs_shares,
465 nfs_shares_config => hiera('cinder::backend::netapp::nfs_shares_config', undef),
466 netapp_copyoffload_tool_path => hiera('cinder::backend::netapp::netapp_copyoffload_tool_path', undef),
467 netapp_controller_ips => hiera('cinder::backend::netapp::netapp_controller_ips', undef),
468 netapp_sa_password => hiera('cinder::backend::netapp::netapp_sa_password', undef),
469 netapp_storage_pools => hiera('cinder::backend::netapp::netapp_storage_pools', undef),
470 netapp_eseries_host_type => hiera('cinder::backend::netapp::netapp_eseries_host_type', undef),
471 netapp_webservice_path => hiera('cinder::backend::netapp::netapp_webservice_path', undef),
475 if hiera('cinder_enable_nfs_backend', false) {
476 $cinder_nfs_backend = 'tripleo_nfs'
478 if str2bool($::selinux) {
479 selboolean { 'virt_use_nfs':
482 } -> Package['nfs-utils']
485 package {'nfs-utils': } ->
486 cinder::backend::nfs { $cinder_nfs_backend :
487 nfs_servers => hiera('cinder_nfs_servers'),
488 nfs_mount_options => hiera('cinder_nfs_mount_options',''),
489 nfs_shares_config => '/etc/cinder/shares-nfs.conf',
493 $cinder_enabled_backends = delete_undef_values([$cinder_iscsi_backend, $cinder_rbd_backend, $cinder_eqlx_backend, $cinder_dellsc_backend, $cinder_netapp_backend, $cinder_nfs_backend])
494 class { '::cinder::backends' :
495 enabled_backends => union($cinder_enabled_backends, hiera('cinder_user_enabled_backends')),
500 include ::swift::proxy
501 include ::swift::proxy::proxy_logging
502 include ::swift::proxy::healthcheck
503 include ::swift::proxy::cache
504 include ::swift::proxy::keystone
505 include ::swift::proxy::authtoken
506 include ::swift::proxy::staticweb
507 include ::swift::proxy::ratelimit
508 include ::swift::proxy::catch_errors
509 include ::swift::proxy::tempurl
510 include ::swift::proxy::formpost
513 if str2bool(hiera('enable_swift_storage', true)) {
514 class { '::swift::storage::all':
515 mount_check => str2bool(hiera('swift_mount_check')),
517 if(!defined(File['/srv/node'])) {
522 require => Package['openstack-swift'],
525 $swift_components = ['account', 'container', 'object']
526 swift::storage::filter::recon { $swift_components : }
527 swift::storage::filter::healthcheck { $swift_components : }
531 $ceilometer_backend = downcase(hiera('ceilometer_backend'))
532 case $ceilometer_backend {
534 $ceilometer_database_connection = hiera('ceilometer_mysql_conn_string')
537 $ceilometer_database_connection = $ceilometer_mongodb_conn_string
541 include ::ceilometer::config
542 include ::ceilometer::api
543 include ::ceilometer::agent::notification
544 include ::ceilometer::agent::central
545 include ::ceilometer::expirer
546 include ::ceilometer::collector
547 include ::ceilometer::agent::auth
548 include ::ceilometer::dispatcher::gnocchi
549 class { '::ceilometer::db' :
550 database_connection => $ceilometer_database_connection,
553 Cron <| title == 'ceilometer-expirer' |> { command => "sleep $((\$(od -A n -t d -N 3 /dev/urandom) % 86400)) && ${::ceilometer::params::expirer_command}" }
557 database_connection => $ceilometer_database_connection,
559 include ::aodh::db::sync
560 # To manage the upgrade:
561 Exec['ceilometer-dbsync'] -> Exec['aodh-db-sync']
564 include ::aodh::wsgi::apache
565 include ::aodh::evaluator
566 include ::aodh::notifier
567 include ::aodh::listener
568 include ::aodh::client
572 include ::sahara::service::api
573 include ::sahara::service::engine
576 include ::apache::mod::remoteip
577 if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') {
578 $_profile_support = 'cisco'
580 $_profile_support = 'None'
582 $neutron_options = {'profile_support' => $_profile_support }
584 $memcached_ipv6 = hiera('memcached_ipv6', false)
586 $horizon_memcached_servers = hiera('memcache_node_ips_v6', '[::1]')
588 $horizon_memcached_servers = hiera('memcache_node_ips', '127.0.0.1')
592 cache_server_ip => $horizon_memcached_servers,
593 neutron_options => $neutron_options,
597 $gnocchi_database_connection = hiera('gnocchi_mysql_conn_string')
599 database_connection => $gnocchi_database_connection,
601 include ::gnocchi::api
602 include ::gnocchi::wsgi::apache
603 include ::gnocchi::client
604 include ::gnocchi::db::sync
605 include ::gnocchi::storage
606 include ::gnocchi::metricd
607 include ::gnocchi::statsd
608 $gnocchi_backend = downcase(hiera('gnocchi_backend', 'swift'))
609 case $gnocchi_backend {
610 'swift': { include ::gnocchi::storage::swift }
611 'file': { include ::gnocchi::storage::file }
612 'rbd': { include ::gnocchi::storage::ceph }
613 default: { fail('Unrecognized gnocchi_backend parameter.') }
616 $snmpd_user = hiera('snmpd_readonly_user_name')
617 snmp::snmpv3_user { $snmpd_user:
619 authpass => hiera('snmpd_readonly_user_password'),
622 agentaddress => ['udp:161','udp6:[::1]:161'],
623 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' ],
626 hiera_include('controller_classes')
630 if hiera('step') >= 5 {
631 $nova_enable_db_purge = hiera('nova_enable_db_purge', true)
632 $cinder_enable_db_purge = hiera('cinder_enable_db_purge', true)
634 if $nova_enable_db_purge {
635 include ::nova::cron::archive_deleted_rows
637 if $cinder_enable_db_purge {
638 include ::cinder::cron::db_purge
642 $package_manifest_name = join(['/var/lib/tripleo/installed-packages/overcloud_controller', hiera('step')])
643 package_manifest{$package_manifest_name: ensure => present}