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
50 include ::mongodb::server
51 $mongo_node_ips_with_port = suffix(hiera('mongo_node_ips'), ':27017')
52 $mongo_node_string = join($mongo_node_ips_with_port, ',')
54 $mongodb_replset = hiera('mongodb::server::replset')
55 $ceilometer_mongodb_conn_string = "mongodb://${mongo_node_string}/ceilometer?replicaSet=${mongodb_replset}"
56 if downcase(hiera('bootstrap_nodeid')) == $::hostname {
57 mongodb_replset { $mongodb_replset :
58 members => $mongo_node_ips_with_port,
64 $redis_node_ips = hiera('redis_node_ips')
65 $redis_master_hostname = downcase(hiera('bootstrap_nodeid'))
67 if $redis_master_hostname == $::hostname {
70 $slaveof = "${redis_master_hostname} 6379"
76 if count($redis_node_ips) > 1 {
77 Class['::tripleo::redis_notification'] -> Service['redis-sentinel']
78 include ::redis::sentinel
79 include ::tripleo::redis_notification
82 if str2bool(hiera('enable_galera', true)) {
83 $mysql_config_file = '/etc/my.cnf.d/galera.cnf'
85 $mysql_config_file = '/etc/my.cnf.d/server.cnf'
88 # FIXME: due to https://bugzilla.redhat.com/show_bug.cgi?id=1298671 we
89 # set bind-address to a hostname instead of an ip address; to move Mysql
90 # from internal_api on another network we'll have to customize both
91 # MysqlNetwork and ControllerHostnameResolveNetwork in ServiceNetMap
92 class { '::mysql::server':
93 config_file => $mysql_config_file,
96 'bind-address' => $::hostname,
97 'max_connections' => hiera('mysql_max_connections'),
98 'open_files_limit' => '-1',
101 remove_default_accounts => true,
104 # FIXME: this should only occur on the bootstrap host (ditto for db syncs)
105 # Create all the database schemas
106 include ::keystone::db::mysql
107 include ::glance::db::mysql
108 include ::nova::db::mysql
109 include ::nova::db::mysql_api
110 include ::neutron::db::mysql
111 include ::cinder::db::mysql
112 include ::heat::db::mysql
113 include ::sahara::db::mysql
114 if downcase(hiera('ceilometer_backend')) == 'mysql' {
115 include ::ceilometer::db::mysql
118 $rabbit_nodes = hiera('rabbit_node_ips')
119 if count($rabbit_nodes) > 1 {
120 class { '::rabbitmq':
121 config_cluster => true,
122 cluster_nodes => $rabbit_nodes,
123 tcp_keepalive => false,
124 config_kernel_variables => hiera('rabbitmq_kernel_variables'),
125 config_variables => hiera('rabbitmq_config_variables'),
126 environment_variables => hiera('rabbitmq_environment'),
128 rabbitmq_policy { 'ha-all@/':
129 pattern => '^(?!amq\.).*',
138 # pre-install swift here so we can build rings
141 $enable_ceph = hiera('ceph_storage_count', 0) > 0 or hiera('enable_ceph_storage', false)
144 class { '::ceph::profile::params':
145 mon_initial_members => downcase(hiera('ceph_mon_initial_members')),
148 include ::ceph::profile::mon
151 if str2bool(hiera('enable_ceph_storage', false)) {
152 if str2bool(hiera('ceph_osd_selinux_permissive', true)) {
153 exec { 'set selinux to permissive on boot':
154 command => "sed -ie 's/^SELINUX=.*/SELINUX=permissive/' /etc/selinux/config",
155 onlyif => "test -f /etc/selinux/config && ! grep '^SELINUX=permissive' /etc/selinux/config",
156 path => ['/usr/bin', '/usr/sbin'],
159 exec { 'set selinux to permissive':
160 command => 'setenforce 0',
161 onlyif => "which setenforce && getenforce | grep -i 'enforcing'",
162 path => ['/usr/bin', '/usr/sbin'],
163 } -> Class['ceph::profile::osd']
167 include ::ceph::profile::osd
170 if str2bool(hiera('enable_external_ceph', false)) {
172 include ::ceph::profile::client
177 if hiera('step') >= 3 {
180 include ::keystone::config
181 include ::keystone::roles::admin
182 include ::keystone::endpoint
183 include ::keystone::wsgi::apache
185 #TODO: need a cleanup-keystone-tokens.sh solution here
187 file { [ '/etc/keystone/ssl', '/etc/keystone/ssl/certs', '/etc/keystone/ssl/private' ]:
188 ensure => 'directory',
191 require => Package['keystone'],
193 file { '/etc/keystone/ssl/certs/signing_cert.pem':
194 content => hiera('keystone_signing_certificate'),
197 notify => Service['keystone'],
198 require => File['/etc/keystone/ssl/certs'],
200 file { '/etc/keystone/ssl/private/signing_key.pem':
201 content => hiera('keystone_signing_key'),
204 notify => Service['keystone'],
205 require => File['/etc/keystone/ssl/private'],
207 file { '/etc/keystone/ssl/certs/ca.pem':
208 content => hiera('keystone_ca_certificate'),
211 notify => Service['keystone'],
212 require => File['/etc/keystone/ssl/certs'],
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.') }
222 $http_store = ['glance.store.http.Store']
223 $glance_store = concat($http_store, $backend_store)
225 # TODO: scrubber and other additional optional features
227 include ::glance::config
228 class { '::glance::api':
229 known_stores => $glance_store,
231 include ::glance::registry
232 include join(['::glance::backend::', $glance_backend])
233 $rabbit_port = hiera('rabbitmq::port')
234 class { '::glance::notify::rabbitmq':
235 rabbit_hosts => suffix(hiera('rabbit_node_ips'), ":${rabbit_port}"),
239 memcached_servers => suffix(hiera('memcache_node_ips'), ':11211'),
241 include ::nova::config
244 include ::nova::conductor
245 include ::nova::consoleauth
246 include ::nova::network::neutron
247 include ::nova::vncproxy
248 include ::nova::scheduler
249 include ::nova::scheduler::filter
251 if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
253 # TODO(devvesa) provide non-controller ips for these services
254 $zookeeper_node_ips = hiera('neutron_api_node_ips')
255 $cassandra_node_ips = hiera('neutron_api_node_ips')
257 # Run zookeeper in the controller if configured
258 if hiera('enable_zookeeper_on_controller') {
259 class {'::tripleo::cluster::zookeeper':
260 zookeeper_server_ips => $zookeeper_node_ips,
261 # TODO: create a 'bind' hiera key for zookeeper
262 zookeeper_client_ip => hiera('neutron::bind_host'),
263 zookeeper_hostnames => hiera('controller_node_names')
267 # Run cassandra in the controller if configured
268 if hiera('enable_cassandra_on_controller') {
269 class {'::tripleo::cluster::cassandra':
270 cassandra_servers => $cassandra_node_ips,
271 # TODO: create a 'bind' hiera key for cassandra
272 cassandra_ip => hiera('neutron::bind_host'),
276 class {'::tripleo::network::midonet::agent':
277 zookeeper_servers => $zookeeper_node_ips,
278 cassandra_seeds => $cassandra_node_ips
281 class {'::tripleo::network::midonet::api':
282 zookeeper_servers => $zookeeper_node_ips,
283 vip => hiera('tripleo::loadbalancer::public_virtual_ip'),
284 keystone_ip => hiera('tripleo::loadbalancer::public_virtual_ip'),
285 keystone_admin_token => hiera('keystone::admin_token'),
286 # TODO: create a 'bind' hiera key for api
287 bind_address => hiera('neutron::bind_host'),
288 admin_password => hiera('admin_password')
291 # TODO: find a way to get an empty list from hiera
293 service_plugins => []
303 include ::neutron::config
304 include ::neutron::server
305 include ::neutron::server::notifications
307 # If the value of core plugin is set to 'nuage' or 'opencontrail',
308 # include nuage or opencontrail core plugins, and it does not
309 # need the l3, dhcp and metadata agents
310 if hiera('neutron::core_plugin') == 'neutron.plugins.nuage.plugin.NuagePlugin' {
311 include ::neutron::plugins::nuage
312 } elsif hiera('neutron::core_plugin') == 'neutron_plugin_contrail.plugins.opencontrail.contrail_plugin.NeutronPluginContrailCoreV2' {
313 include ::neutron::plugins::opencontrail
315 include ::neutron::agents::l3
316 include ::neutron::agents::dhcp
317 include ::neutron::agents::metadata
319 file { '/etc/neutron/dnsmasq-neutron.conf':
320 content => hiera('neutron_dnsmasq_options'),
323 notify => Service['neutron-dhcp-service'],
324 require => Package['neutron'],
327 # If the value of core plugin is set to 'midonet',
328 # skip all the ML2 configuration
329 if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
331 class {'::neutron::plugins::midonet':
332 midonet_api_ip => hiera('tripleo::loadbalancer::public_virtual_ip'),
333 keystone_tenant => hiera('neutron::server::auth_tenant'),
334 keystone_password => hiera('neutron::server::auth_password')
338 include ::neutron::plugins::ml2
339 include ::neutron::agents::ml2::ovs
341 if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') {
342 include ::neutron::plugins::ml2::cisco::nexus1000v
344 class { '::neutron::agents::n1kv_vem':
345 n1kv_source => hiera('n1kv_vem_source', undef),
346 n1kv_version => hiera('n1kv_vem_version', undef),
350 n1kv_source => hiera('n1kv_vsm_source', undef),
351 n1kv_version => hiera('n1kv_vsm_version', undef),
352 pacemaker_control => false,
356 if 'cisco_ucsm' in hiera('neutron::plugins::ml2::mechanism_drivers') {
357 include ::neutron::plugins::ml2::cisco::ucsm
359 if 'cisco_nexus' in hiera('neutron::plugins::ml2::mechanism_drivers') {
360 include ::neutron::plugins::ml2::cisco::nexus
361 include ::neutron::plugins::ml2::cisco::type_nexus_vxlan
364 if 'bsn_ml2' in hiera('neutron::plugins::ml2::mechanism_drivers') {
365 include ::neutron::plugins::ml2::bigswitch::restproxy
366 include ::neutron::agents::bigswitch
368 neutron_l3_agent_config {
369 'DEFAULT/ovs_use_veth': value => hiera('neutron_ovs_use_veth', false);
371 neutron_dhcp_agent_config {
372 'DEFAULT/ovs_use_veth': value => hiera('neutron_ovs_use_veth', false);
374 Service['neutron-server'] -> Service['neutron-ovs-agent-service']
377 Service['neutron-server'] -> Service['neutron-dhcp-service']
378 Service['neutron-server'] -> Service['neutron-l3']
379 Service['neutron-server'] -> Service['neutron-metadata']
383 include ::cinder::config
384 include ::tripleo::ssl::cinder_config
385 include ::cinder::api
386 include ::cinder::glance
387 include ::cinder::scheduler
388 include ::cinder::volume
389 include ::cinder::ceilometer
390 class { '::cinder::setup_test_volume':
391 size => join([hiera('cinder_lvm_loop_device_size'), 'M']),
394 $cinder_enable_iscsi = hiera('cinder_enable_iscsi_backend', true)
395 if $cinder_enable_iscsi {
396 $cinder_iscsi_backend = 'tripleo_iscsi'
398 cinder::backend::iscsi { $cinder_iscsi_backend :
399 iscsi_ip_address => hiera('cinder_iscsi_ip_address'),
400 iscsi_helper => hiera('cinder_iscsi_helper'),
406 $ceph_pools = hiera('ceph_pools')
407 ceph::pool { $ceph_pools :
408 pg_num => hiera('ceph::profile::params::osd_pool_default_pg_num'),
409 pgp_num => hiera('ceph::profile::params::osd_pool_default_pgp_num'),
410 size => hiera('ceph::profile::params::osd_pool_default_size'),
413 $cinder_pool_requires = [Ceph::Pool[hiera('cinder_rbd_pool_name')]]
416 $cinder_pool_requires = []
419 if hiera('cinder_enable_rbd_backend', false) {
420 $cinder_rbd_backend = 'tripleo_ceph'
422 cinder::backend::rbd { $cinder_rbd_backend :
423 rbd_pool => hiera('cinder_rbd_pool_name'),
424 rbd_user => hiera('ceph_client_user_name'),
425 rbd_secret_uuid => hiera('ceph::profile::params::fsid'),
426 require => $cinder_pool_requires,
430 if hiera('cinder_enable_eqlx_backend', false) {
431 $cinder_eqlx_backend = hiera('cinder::backend::eqlx::volume_backend_name')
433 cinder::backend::eqlx { $cinder_eqlx_backend :
434 volume_backend_name => hiera('cinder::backend::eqlx::volume_backend_name', undef),
435 san_ip => hiera('cinder::backend::eqlx::san_ip', undef),
436 san_login => hiera('cinder::backend::eqlx::san_login', undef),
437 san_password => hiera('cinder::backend::eqlx::san_password', undef),
438 san_thin_provision => hiera('cinder::backend::eqlx::san_thin_provision', undef),
439 eqlx_group_name => hiera('cinder::backend::eqlx::eqlx_group_name', undef),
440 eqlx_pool => hiera('cinder::backend::eqlx::eqlx_pool', undef),
441 eqlx_use_chap => hiera('cinder::backend::eqlx::eqlx_use_chap', undef),
442 eqlx_chap_login => hiera('cinder::backend::eqlx::eqlx_chap_login', undef),
443 eqlx_chap_password => hiera('cinder::backend::eqlx::eqlx_san_password', undef),
447 if hiera('cinder_enable_dellsc_backend', false) {
448 $cinder_dellsc_backend = hiera('cinder::backend::dellsc_iscsi::volume_backend_name')
450 cinder::backend::dellsc_iscsi{ $cinder_dellsc_backend :
451 volume_backend_name => hiera('cinder::backend::dellsc_iscsi::volume_backend_name', undef),
452 san_ip => hiera('cinder::backend::dellsc_iscsi::san_ip', undef),
453 san_login => hiera('cinder::backend::dellsc_iscsi::san_login', undef),
454 san_password => hiera('cinder::backend::dellsc_iscsi::san_password', undef),
455 dell_sc_ssn => hiera('cinder::backend::dellsc_iscsi::dell_sc_ssn', undef),
456 iscsi_ip_address => hiera('cinder::backend::dellsc_iscsi::iscsi_ip_address', undef),
457 iscsi_port => hiera('cinder::backend::dellsc_iscsi::iscsi_port', undef),
458 dell_sc_api_port => hiera('cinder::backend::dellsc_iscsi::dell_sc_api_port', undef),
459 dell_sc_server_folder => hiera('cinder::backend::dellsc_iscsi::dell_sc_server_folder', undef),
460 dell_sc_volume_folder => hiera('cinder::backend::dellsc_iscsi::dell_sc_volume_folder', undef),
464 if hiera('cinder_enable_netapp_backend', false) {
465 $cinder_netapp_backend = hiera('cinder::backend::netapp::title')
467 if hiera('cinder::backend::netapp::nfs_shares', undef) {
468 $cinder_netapp_nfs_shares = split(hiera('cinder::backend::netapp::nfs_shares', undef), ',')
471 cinder::backend::netapp { $cinder_netapp_backend :
472 netapp_login => hiera('cinder::backend::netapp::netapp_login', undef),
473 netapp_password => hiera('cinder::backend::netapp::netapp_password', undef),
474 netapp_server_hostname => hiera('cinder::backend::netapp::netapp_server_hostname', undef),
475 netapp_server_port => hiera('cinder::backend::netapp::netapp_server_port', undef),
476 netapp_size_multiplier => hiera('cinder::backend::netapp::netapp_size_multiplier', undef),
477 netapp_storage_family => hiera('cinder::backend::netapp::netapp_storage_family', undef),
478 netapp_storage_protocol => hiera('cinder::backend::netapp::netapp_storage_protocol', undef),
479 netapp_transport_type => hiera('cinder::backend::netapp::netapp_transport_type', undef),
480 netapp_vfiler => hiera('cinder::backend::netapp::netapp_vfiler', undef),
481 netapp_volume_list => hiera('cinder::backend::netapp::netapp_volume_list', undef),
482 netapp_vserver => hiera('cinder::backend::netapp::netapp_vserver', undef),
483 netapp_partner_backend_name => hiera('cinder::backend::netapp::netapp_partner_backend_name', undef),
484 nfs_shares => $cinder_netapp_nfs_shares,
485 nfs_shares_config => hiera('cinder::backend::netapp::nfs_shares_config', undef),
486 netapp_copyoffload_tool_path => hiera('cinder::backend::netapp::netapp_copyoffload_tool_path', undef),
487 netapp_controller_ips => hiera('cinder::backend::netapp::netapp_controller_ips', undef),
488 netapp_sa_password => hiera('cinder::backend::netapp::netapp_sa_password', undef),
489 netapp_storage_pools => hiera('cinder::backend::netapp::netapp_storage_pools', undef),
490 netapp_eseries_host_type => hiera('cinder::backend::netapp::netapp_eseries_host_type', undef),
491 netapp_webservice_path => hiera('cinder::backend::netapp::netapp_webservice_path', undef),
495 if hiera('cinder_enable_nfs_backend', false) {
496 $cinder_nfs_backend = 'tripleo_nfs'
498 if str2bool($::selinux) {
499 selboolean { 'virt_use_nfs':
502 } -> Package['nfs-utils']
505 package {'nfs-utils': } ->
506 cinder::backend::nfs { $cinder_nfs_backend :
507 nfs_servers => hiera('cinder_nfs_servers'),
508 nfs_mount_options => hiera('cinder_nfs_mount_options',''),
509 nfs_shares_config => '/etc/cinder/shares-nfs.conf',
513 $cinder_enabled_backends = delete_undef_values([$cinder_iscsi_backend, $cinder_rbd_backend, $cinder_eqlx_backend, $cinder_dellsc_backend, $cinder_netapp_backend, $cinder_nfs_backend])
514 class { '::cinder::backends' :
515 enabled_backends => $cinder_enabled_backends,
520 include ::swift::proxy
521 include ::swift::proxy::proxy_logging
522 include ::swift::proxy::healthcheck
523 include ::swift::proxy::cache
524 include ::swift::proxy::keystone
525 include ::swift::proxy::authtoken
526 include ::swift::proxy::staticweb
527 include ::swift::proxy::ratelimit
528 include ::swift::proxy::catch_errors
529 include ::swift::proxy::tempurl
530 include ::swift::proxy::formpost
533 if str2bool(hiera('enable_swift_storage', true)) {
534 class { '::swift::storage::all':
535 mount_check => str2bool(hiera('swift_mount_check')),
537 if(!defined(File['/srv/node'])) {
542 require => Package['openstack-swift'],
545 $swift_components = ['account', 'container', 'object']
546 swift::storage::filter::recon { $swift_components : }
547 swift::storage::filter::healthcheck { $swift_components : }
551 $ceilometer_backend = downcase(hiera('ceilometer_backend'))
552 case $ceilometer_backend {
554 $ceilometer_database_connection = hiera('ceilometer_mysql_conn_string')
557 $ceilometer_database_connection = $ceilometer_mongodb_conn_string
561 include ::ceilometer::config
562 include ::ceilometer::api
563 include ::ceilometer::agent::notification
564 include ::ceilometer::agent::central
565 include ::ceilometer::expirer
566 include ::ceilometer::collector
567 include ::ceilometer::agent::auth
568 class { '::ceilometer::db' :
569 database_connection => $ceilometer_database_connection,
572 Cron <| title == 'ceilometer-expirer' |> { command => "sleep $((\$(od -A n -t d -N 3 /dev/urandom) % 86400)) && ${::ceilometer::params::expirer_command}" }
576 notification_driver => 'messaging',
578 include ::heat::config
580 include ::heat::api_cfn
581 include ::heat::api_cloudwatch
582 include ::heat::engine
586 include ::sahara::service::api
587 include ::sahara::service::engine
590 if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') {
591 $_profile_support = 'cisco'
593 $_profile_support = 'None'
595 $neutron_options = {'profile_support' => $_profile_support }
598 cache_server_ip => hiera('memcache_node_ips', '127.0.0.1'),
599 neutron_options => $neutron_options,
602 $snmpd_user = hiera('snmpd_readonly_user_name')
603 snmp::snmpv3_user { $snmpd_user:
605 authpass => hiera('snmpd_readonly_user_password'),
608 agentaddress => ['udp:161','udp6:[::1]:161'],
609 snmpd_config => [ join(['rouser ', hiera('snmpd_readonly_user_name')]), 'proc cron', 'includeAllDisks 10%', 'master agentx', 'trapsink localhost public', 'iquerySecName internalUser', 'rouser internalUser', 'defaultMonitors yes', 'linkUpDownNotifications yes' ],
612 hiera_include('controller_classes')
616 if hiera('step') >= 4 {
617 $keystone_enable_db_purge = hiera('keystone_enable_db_purge', true)
618 $nova_enable_db_purge = hiera('nova_enable_db_purge', true)
619 $cinder_enable_db_purge = hiera('cinder_enable_db_purge', true)
621 if $keystone_enable_db_purge {
622 include ::keystone::cron::token_flush
624 if $nova_enable_db_purge {
625 include ::nova::cron::archive_deleted_rows
627 if $cinder_enable_db_purge {
628 include ::cinder::cron::db_purge
632 $package_manifest_name = join(['/var/lib/tripleo/installed-packages/overcloud_controller', hiera('step')])
633 package_manifest{$package_manifest_name: ensure => present}