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 ::glance::notify::rabbitmq
233 include join(['::glance::backend::', $glance_backend])
236 memcached_servers => suffix(hiera('memcache_node_ips'), ':11211'),
238 include ::nova::config
241 include ::nova::conductor
242 include ::nova::consoleauth
243 include ::nova::network::neutron
244 include ::nova::vncproxy
245 include ::nova::scheduler
246 include ::nova::scheduler::filter
248 if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
250 # TODO(devvesa) provide non-controller ips for these services
251 $zookeeper_node_ips = hiera('neutron_api_node_ips')
252 $cassandra_node_ips = hiera('neutron_api_node_ips')
254 # Run zookeeper in the controller if configured
255 if hiera('enable_zookeeper_on_controller') {
256 class {'::tripleo::cluster::zookeeper':
257 zookeeper_server_ips => $zookeeper_node_ips,
258 # TODO: create a 'bind' hiera key for zookeeper
259 zookeeper_client_ip => hiera('neutron::bind_host'),
260 zookeeper_hostnames => hiera('controller_node_names')
264 # Run cassandra in the controller if configured
265 if hiera('enable_cassandra_on_controller') {
266 class {'::tripleo::cluster::cassandra':
267 cassandra_servers => $cassandra_node_ips,
268 # TODO: create a 'bind' hiera key for cassandra
269 cassandra_ip => hiera('neutron::bind_host'),
273 class {'::tripleo::network::midonet::agent':
274 zookeeper_servers => $zookeeper_node_ips,
275 cassandra_seeds => $cassandra_node_ips
278 class {'::tripleo::network::midonet::api':
279 zookeeper_servers => $zookeeper_node_ips,
280 vip => hiera('tripleo::loadbalancer::public_virtual_ip'),
281 keystone_ip => hiera('tripleo::loadbalancer::public_virtual_ip'),
282 keystone_admin_token => hiera('keystone::admin_token'),
283 # TODO: create a 'bind' hiera key for api
284 bind_address => hiera('neutron::bind_host'),
285 admin_password => hiera('admin_password')
288 # TODO: find a way to get an empty list from hiera
290 service_plugins => []
300 include ::neutron::config
301 include ::neutron::server
302 include ::neutron::server::notifications
304 # If the value of core plugin is set to 'nuage' or 'opencontrail',
305 # include nuage or opencontrail core plugins, and it does not
306 # need the l3, dhcp and metadata agents
307 if hiera('neutron::core_plugin') == 'neutron.plugins.nuage.plugin.NuagePlugin' {
308 include ::neutron::plugins::nuage
309 } elsif hiera('neutron::core_plugin') == 'neutron_plugin_contrail.plugins.opencontrail.contrail_plugin.NeutronPluginContrailCoreV2' {
310 include ::neutron::plugins::opencontrail
312 include ::neutron::agents::l3
313 include ::neutron::agents::dhcp
314 include ::neutron::agents::metadata
316 file { '/etc/neutron/dnsmasq-neutron.conf':
317 content => hiera('neutron_dnsmasq_options'),
320 notify => Service['neutron-dhcp-service'],
321 require => Package['neutron'],
324 # If the value of core plugin is set to 'midonet',
325 # skip all the ML2 configuration
326 if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
328 class {'::neutron::plugins::midonet':
329 midonet_api_ip => hiera('tripleo::loadbalancer::public_virtual_ip'),
330 keystone_tenant => hiera('neutron::server::auth_tenant'),
331 keystone_password => hiera('neutron::server::auth_password')
335 include ::neutron::plugins::ml2
336 include ::neutron::agents::ml2::ovs
338 if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') {
339 include ::neutron::plugins::ml2::cisco::nexus1000v
341 class { '::neutron::agents::n1kv_vem':
342 n1kv_source => hiera('n1kv_vem_source', undef),
343 n1kv_version => hiera('n1kv_vem_version', undef),
347 n1kv_source => hiera('n1kv_vsm_source', undef),
348 n1kv_version => hiera('n1kv_vsm_version', undef),
349 pacemaker_control => false,
353 if 'cisco_ucsm' in hiera('neutron::plugins::ml2::mechanism_drivers') {
354 include ::neutron::plugins::ml2::cisco::ucsm
356 if 'cisco_nexus' in hiera('neutron::plugins::ml2::mechanism_drivers') {
357 include ::neutron::plugins::ml2::cisco::nexus
358 include ::neutron::plugins::ml2::cisco::type_nexus_vxlan
361 if 'bsn_ml2' in hiera('neutron::plugins::ml2::mechanism_drivers') {
362 include ::neutron::plugins::ml2::bigswitch::restproxy
363 include ::neutron::agents::bigswitch
365 neutron_l3_agent_config {
366 'DEFAULT/ovs_use_veth': value => hiera('neutron_ovs_use_veth', false);
368 neutron_dhcp_agent_config {
369 'DEFAULT/ovs_use_veth': value => hiera('neutron_ovs_use_veth', false);
371 Service['neutron-server'] -> Service['neutron-ovs-agent-service']
374 Service['neutron-server'] -> Service['neutron-dhcp-service']
375 Service['neutron-server'] -> Service['neutron-l3']
376 Service['neutron-server'] -> Service['neutron-metadata']
380 include ::cinder::config
381 include ::tripleo::ssl::cinder_config
382 include ::cinder::api
383 include ::cinder::glance
384 include ::cinder::scheduler
385 include ::cinder::volume
386 include ::cinder::ceilometer
387 class { '::cinder::setup_test_volume':
388 size => join([hiera('cinder_lvm_loop_device_size'), 'M']),
391 $cinder_enable_iscsi = hiera('cinder_enable_iscsi_backend', true)
392 if $cinder_enable_iscsi {
393 $cinder_iscsi_backend = 'tripleo_iscsi'
395 cinder::backend::iscsi { $cinder_iscsi_backend :
396 iscsi_ip_address => hiera('cinder_iscsi_ip_address'),
397 iscsi_helper => hiera('cinder_iscsi_helper'),
403 $ceph_pools = hiera('ceph_pools')
404 ceph::pool { $ceph_pools :
405 pg_num => hiera('ceph::profile::params::osd_pool_default_pg_num'),
406 pgp_num => hiera('ceph::profile::params::osd_pool_default_pgp_num'),
407 size => hiera('ceph::profile::params::osd_pool_default_size'),
410 $cinder_pool_requires = [Ceph::Pool[hiera('cinder_rbd_pool_name')]]
413 $cinder_pool_requires = []
416 if hiera('cinder_enable_rbd_backend', false) {
417 $cinder_rbd_backend = 'tripleo_ceph'
419 cinder::backend::rbd { $cinder_rbd_backend :
420 rbd_pool => hiera('cinder_rbd_pool_name'),
421 rbd_user => hiera('ceph_client_user_name'),
422 rbd_secret_uuid => hiera('ceph::profile::params::fsid'),
423 require => $cinder_pool_requires,
427 if hiera('cinder_enable_eqlx_backend', false) {
428 $cinder_eqlx_backend = hiera('cinder::backend::eqlx::volume_backend_name')
430 cinder::backend::eqlx { $cinder_eqlx_backend :
431 volume_backend_name => hiera('cinder::backend::eqlx::volume_backend_name', undef),
432 san_ip => hiera('cinder::backend::eqlx::san_ip', undef),
433 san_login => hiera('cinder::backend::eqlx::san_login', undef),
434 san_password => hiera('cinder::backend::eqlx::san_password', undef),
435 san_thin_provision => hiera('cinder::backend::eqlx::san_thin_provision', undef),
436 eqlx_group_name => hiera('cinder::backend::eqlx::eqlx_group_name', undef),
437 eqlx_pool => hiera('cinder::backend::eqlx::eqlx_pool', undef),
438 eqlx_use_chap => hiera('cinder::backend::eqlx::eqlx_use_chap', undef),
439 eqlx_chap_login => hiera('cinder::backend::eqlx::eqlx_chap_login', undef),
440 eqlx_chap_password => hiera('cinder::backend::eqlx::eqlx_san_password', undef),
444 if hiera('cinder_enable_dellsc_backend', false) {
445 $cinder_dellsc_backend = hiera('cinder::backend::dellsc_iscsi::volume_backend_name')
447 cinder::backend::dellsc_iscsi{ $cinder_dellsc_backend :
448 volume_backend_name => hiera('cinder::backend::dellsc_iscsi::volume_backend_name', undef),
449 san_ip => hiera('cinder::backend::dellsc_iscsi::san_ip', undef),
450 san_login => hiera('cinder::backend::dellsc_iscsi::san_login', undef),
451 san_password => hiera('cinder::backend::dellsc_iscsi::san_password', undef),
452 dell_sc_ssn => hiera('cinder::backend::dellsc_iscsi::dell_sc_ssn', undef),
453 iscsi_ip_address => hiera('cinder::backend::dellsc_iscsi::iscsi_ip_address', undef),
454 iscsi_port => hiera('cinder::backend::dellsc_iscsi::iscsi_port', undef),
455 dell_sc_api_port => hiera('cinder::backend::dellsc_iscsi::dell_sc_api_port', undef),
456 dell_sc_server_folder => hiera('cinder::backend::dellsc_iscsi::dell_sc_server_folder', undef),
457 dell_sc_volume_folder => hiera('cinder::backend::dellsc_iscsi::dell_sc_volume_folder', undef),
461 if hiera('cinder_enable_netapp_backend', false) {
462 $cinder_netapp_backend = hiera('cinder::backend::netapp::title')
464 if hiera('cinder::backend::netapp::nfs_shares', undef) {
465 $cinder_netapp_nfs_shares = split(hiera('cinder::backend::netapp::nfs_shares', undef), ',')
468 cinder::backend::netapp { $cinder_netapp_backend :
469 netapp_login => hiera('cinder::backend::netapp::netapp_login', undef),
470 netapp_password => hiera('cinder::backend::netapp::netapp_password', undef),
471 netapp_server_hostname => hiera('cinder::backend::netapp::netapp_server_hostname', undef),
472 netapp_server_port => hiera('cinder::backend::netapp::netapp_server_port', undef),
473 netapp_size_multiplier => hiera('cinder::backend::netapp::netapp_size_multiplier', undef),
474 netapp_storage_family => hiera('cinder::backend::netapp::netapp_storage_family', undef),
475 netapp_storage_protocol => hiera('cinder::backend::netapp::netapp_storage_protocol', undef),
476 netapp_transport_type => hiera('cinder::backend::netapp::netapp_transport_type', undef),
477 netapp_vfiler => hiera('cinder::backend::netapp::netapp_vfiler', undef),
478 netapp_volume_list => hiera('cinder::backend::netapp::netapp_volume_list', undef),
479 netapp_vserver => hiera('cinder::backend::netapp::netapp_vserver', undef),
480 netapp_partner_backend_name => hiera('cinder::backend::netapp::netapp_partner_backend_name', undef),
481 nfs_shares => $cinder_netapp_nfs_shares,
482 nfs_shares_config => hiera('cinder::backend::netapp::nfs_shares_config', undef),
483 netapp_copyoffload_tool_path => hiera('cinder::backend::netapp::netapp_copyoffload_tool_path', undef),
484 netapp_controller_ips => hiera('cinder::backend::netapp::netapp_controller_ips', undef),
485 netapp_sa_password => hiera('cinder::backend::netapp::netapp_sa_password', undef),
486 netapp_storage_pools => hiera('cinder::backend::netapp::netapp_storage_pools', undef),
487 netapp_eseries_host_type => hiera('cinder::backend::netapp::netapp_eseries_host_type', undef),
488 netapp_webservice_path => hiera('cinder::backend::netapp::netapp_webservice_path', undef),
492 if hiera('cinder_enable_nfs_backend', false) {
493 $cinder_nfs_backend = 'tripleo_nfs'
495 if str2bool($::selinux) {
496 selboolean { 'virt_use_nfs':
499 } -> Package['nfs-utils']
502 package {'nfs-utils': } ->
503 cinder::backend::nfs { $cinder_nfs_backend :
504 nfs_servers => hiera('cinder_nfs_servers'),
505 nfs_mount_options => hiera('cinder_nfs_mount_options',''),
506 nfs_shares_config => '/etc/cinder/shares-nfs.conf',
510 $cinder_enabled_backends = delete_undef_values([$cinder_iscsi_backend, $cinder_rbd_backend, $cinder_eqlx_backend, $cinder_dellsc_backend, $cinder_netapp_backend, $cinder_nfs_backend])
511 class { '::cinder::backends' :
512 enabled_backends => $cinder_enabled_backends,
517 include ::swift::proxy
518 include ::swift::proxy::proxy_logging
519 include ::swift::proxy::healthcheck
520 include ::swift::proxy::cache
521 include ::swift::proxy::keystone
522 include ::swift::proxy::authtoken
523 include ::swift::proxy::staticweb
524 include ::swift::proxy::ratelimit
525 include ::swift::proxy::catch_errors
526 include ::swift::proxy::tempurl
527 include ::swift::proxy::formpost
530 if str2bool(hiera('enable_swift_storage', true)) {
531 class { '::swift::storage::all':
532 mount_check => str2bool(hiera('swift_mount_check')),
534 if(!defined(File['/srv/node'])) {
539 require => Package['openstack-swift'],
542 $swift_components = ['account', 'container', 'object']
543 swift::storage::filter::recon { $swift_components : }
544 swift::storage::filter::healthcheck { $swift_components : }
548 $ceilometer_backend = downcase(hiera('ceilometer_backend'))
549 case $ceilometer_backend {
551 $ceilometer_database_connection = hiera('ceilometer_mysql_conn_string')
554 $ceilometer_database_connection = $ceilometer_mongodb_conn_string
558 include ::ceilometer::config
559 include ::ceilometer::api
560 include ::ceilometer::agent::notification
561 include ::ceilometer::agent::central
562 include ::ceilometer::expirer
563 include ::ceilometer::collector
564 include ::ceilometer::agent::auth
565 class { '::ceilometer::db' :
566 database_connection => $ceilometer_database_connection,
569 Cron <| title == 'ceilometer-expirer' |> { command => "sleep $((\$(od -A n -t d -N 3 /dev/urandom) % 86400)) && ${::ceilometer::params::expirer_command}" }
573 notification_driver => 'messaging',
575 include ::heat::config
577 include ::heat::api_cfn
578 include ::heat::api_cloudwatch
579 include ::heat::engine
583 include ::sahara::service::api
584 include ::sahara::service::engine
587 if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') {
588 $_profile_support = 'cisco'
590 $_profile_support = 'None'
592 $neutron_options = {'profile_support' => $_profile_support }
595 cache_server_ip => hiera('memcache_node_ips', '127.0.0.1'),
596 neutron_options => $neutron_options,
599 $snmpd_user = hiera('snmpd_readonly_user_name')
600 snmp::snmpv3_user { $snmpd_user:
602 authpass => hiera('snmpd_readonly_user_password'),
605 agentaddress => ['udp:161','udp6:[::1]:161'],
606 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' ],
609 hiera_include('controller_classes')
613 if hiera('step') >= 4 {
614 $keystone_enable_db_purge = hiera('keystone_enable_db_purge', true)
615 $nova_enable_db_purge = hiera('nova_enable_db_purge', true)
616 $cinder_enable_db_purge = hiera('cinder_enable_db_purge', true)
617 $heat_enable_db_purge = hiera('heat_enable_db_purge', true)
619 if $keystone_enable_db_purge {
620 include ::keystone::cron::token_flush
622 if $nova_enable_db_purge {
623 include ::nova::cron::archive_deleted_rows
625 if $cinder_enable_db_purge {
626 include ::cinder::cron::db_purge
628 if $heat_enable_db_purge {
629 include ::heat::cron::purge_deleted
633 $package_manifest_name = join(['/var/lib/tripleo/installed-packages/overcloud_controller', hiera('step')])
634 package_manifest{$package_manifest_name: ensure => present}