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(sysctl::value, hiera('sysctl_settings'), {})
25 $controller_node_ips = split(hiera('controller_node_ips'), ',')
27 if $enable_load_balancer {
28 class { '::tripleo::loadbalancer' :
29 controller_hosts => $controller_node_ips,
36 if hiera('step') >= 2 {
38 if count(hiera('ntp::servers')) > 0 {
45 if downcase(hiera('ceilometer_backend')) == 'mongodb' {
46 include ::mongodb::globals
48 include ::mongodb::server
49 $mongo_node_ips_with_port = suffix(hiera('mongo_node_ips'), ':27017')
50 $mongo_node_string = join($mongo_node_ips_with_port, ',')
52 $mongodb_replset = hiera('mongodb::server::replset')
53 $ceilometer_mongodb_conn_string = "mongodb://${mongo_node_string}/ceilometer?replicaSet=${mongodb_replset}"
54 if downcase(hiera('bootstrap_nodeid')) == $::hostname {
55 mongodb_replset { $mongodb_replset :
56 members => $mongo_node_ips_with_port,
62 $redis_node_ips = hiera('redis_node_ips')
63 $redis_master_hostname = downcase(hiera('bootstrap_nodeid'))
65 if $redis_master_hostname == $::hostname {
68 $slaveof = "${redis_master_hostname} 6379"
74 if count($redis_node_ips) > 1 {
75 Class['::tripleo::redis_notification'] -> Service['redis-sentinel']
76 include ::redis::sentinel
77 include ::tripleo::redis_notification
80 if str2bool(hiera('enable_galera', true)) {
81 $mysql_config_file = '/etc/my.cnf.d/galera.cnf'
83 $mysql_config_file = '/etc/my.cnf.d/server.cnf'
86 # FIXME: due to https://bugzilla.redhat.com/show_bug.cgi?id=1298671 we
87 # set bind-address to a hostname instead of an ip address; to move Mysql
88 # from internal_api on another network we'll have to customize both
89 # MysqlNetwork and ControllerHostnameResolveNetwork in ServiceNetMap
90 class { '::mysql::server':
91 config_file => $mysql_config_file,
94 'bind-address' => $::hostname,
95 'max_connections' => hiera('mysql_max_connections'),
96 'open_files_limit' => '-1',
99 remove_default_accounts => true,
102 # FIXME: this should only occur on the bootstrap host (ditto for db syncs)
103 # Create all the database schemas
104 include ::keystone::db::mysql
105 include ::glance::db::mysql
106 include ::nova::db::mysql
107 include ::nova::db::mysql_api
108 include ::neutron::db::mysql
109 include ::cinder::db::mysql
110 include ::heat::db::mysql
111 include ::sahara::db::mysql
112 if downcase(hiera('ceilometer_backend')) == 'mysql' {
113 include ::ceilometer::db::mysql
116 $rabbit_nodes = hiera('rabbit_node_ips')
117 if count($rabbit_nodes) > 1 {
118 class { '::rabbitmq':
119 config_cluster => true,
120 cluster_nodes => $rabbit_nodes,
121 tcp_keepalive => false,
122 config_kernel_variables => hiera('rabbitmq_kernel_variables'),
123 config_variables => hiera('rabbitmq_config_variables'),
124 environment_variables => hiera('rabbitmq_environment'),
126 rabbitmq_policy { 'ha-all@/':
127 pattern => '^(?!amq\.).*',
136 # pre-install swift here so we can build rings
139 $enable_ceph = hiera('ceph_storage_count', 0) > 0 or hiera('enable_ceph_storage', false)
142 class { '::ceph::profile::params':
143 mon_initial_members => downcase(hiera('ceph_mon_initial_members')),
146 include ::ceph::profile::mon
149 if str2bool(hiera('enable_ceph_storage', false)) {
150 if str2bool(hiera('ceph_osd_selinux_permissive', true)) {
151 exec { 'set selinux to permissive on boot':
152 command => "sed -ie 's/^SELINUX=.*/SELINUX=permissive/' /etc/selinux/config",
153 onlyif => "test -f /etc/selinux/config && ! grep '^SELINUX=permissive' /etc/selinux/config",
154 path => ['/usr/bin', '/usr/sbin'],
157 exec { 'set selinux to permissive':
158 command => 'setenforce 0',
159 onlyif => "which setenforce && getenforce | grep -i 'enforcing'",
160 path => ['/usr/bin', '/usr/sbin'],
161 } -> Class['ceph::profile::osd']
165 include ::ceph::profile::osd
168 if str2bool(hiera('enable_external_ceph', false)) {
170 include ::ceph::profile::client
175 if hiera('step') >= 3 {
178 include ::keystone::config
179 include ::keystone::roles::admin
180 include ::keystone::endpoint
181 include ::keystone::wsgi::apache
183 #TODO: need a cleanup-keystone-tokens.sh solution here
185 file { [ '/etc/keystone/ssl', '/etc/keystone/ssl/certs', '/etc/keystone/ssl/private' ]:
186 ensure => 'directory',
189 require => Package['keystone'],
191 file { '/etc/keystone/ssl/certs/signing_cert.pem':
192 content => hiera('keystone_signing_certificate'),
195 notify => Service['keystone'],
196 require => File['/etc/keystone/ssl/certs'],
198 file { '/etc/keystone/ssl/private/signing_key.pem':
199 content => hiera('keystone_signing_key'),
202 notify => Service['keystone'],
203 require => File['/etc/keystone/ssl/private'],
205 file { '/etc/keystone/ssl/certs/ca.pem':
206 content => hiera('keystone_ca_certificate'),
209 notify => Service['keystone'],
210 require => File['/etc/keystone/ssl/certs'],
213 $glance_backend = downcase(hiera('glance_backend', 'swift'))
214 case $glance_backend {
215 'swift': { $backend_store = 'glance.store.swift.Store' }
216 'file': { $backend_store = 'glance.store.filesystem.Store' }
217 'rbd': { $backend_store = 'glance.store.rbd.Store' }
218 default: { fail('Unrecognized glance_backend parameter.') }
220 $http_store = ['glance.store.http.Store']
221 $glance_store = concat($http_store, $backend_store)
223 # TODO: notifications, scrubber, etc.
225 include ::glance::config
226 class { '::glance::api':
227 known_stores => $glance_store,
229 include ::glance::registry
230 include join(['::glance::backend::', $glance_backend])
233 memcached_servers => suffix(hiera('memcache_node_ips'), ':11211'),
235 include ::nova::config
238 include ::nova::conductor
239 include ::nova::consoleauth
240 include ::nova::network::neutron
241 include ::nova::vncproxy
242 include ::nova::scheduler
243 include ::nova::scheduler::filter
245 if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
247 # TODO(devvesa) provide non-controller ips for these services
248 $zookeeper_node_ips = hiera('neutron_api_node_ips')
249 $cassandra_node_ips = hiera('neutron_api_node_ips')
251 # Run zookeeper in the controller if configured
252 if hiera('enable_zookeeper_on_controller') {
253 class {'::tripleo::cluster::zookeeper':
254 zookeeper_server_ips => $zookeeper_node_ips,
255 # TODO: create a 'bind' hiera key for zookeeper
256 zookeeper_client_ip => hiera('neutron::bind_host'),
257 zookeeper_hostnames => hiera('controller_node_names')
261 # Run cassandra in the controller if configured
262 if hiera('enable_cassandra_on_controller') {
263 class {'::tripleo::cluster::cassandra':
264 cassandra_servers => $cassandra_node_ips,
265 # TODO: create a 'bind' hiera key for cassandra
266 cassandra_ip => hiera('neutron::bind_host'),
270 class {'::tripleo::network::midonet::agent':
271 zookeeper_servers => $zookeeper_node_ips,
272 cassandra_seeds => $cassandra_node_ips
275 class {'::tripleo::network::midonet::api':
276 zookeeper_servers => $zookeeper_node_ips,
277 vip => hiera('tripleo::loadbalancer::public_virtual_ip'),
278 keystone_ip => hiera('tripleo::loadbalancer::public_virtual_ip'),
279 keystone_admin_token => hiera('keystone::admin_token'),
280 # TODO: create a 'bind' hiera key for api
281 bind_address => hiera('neutron::bind_host'),
282 admin_password => hiera('admin_password')
285 # TODO: find a way to get an empty list from hiera
287 service_plugins => []
297 include ::neutron::config
298 include ::neutron::server
299 include ::neutron::server::notifications
301 # If the value of core plugin is set to 'nuage',
302 # include nuage core plugin, and it does not
303 # need the l3, dhcp and metadata agents
304 if hiera('neutron::core_plugin') == 'neutron.plugins.nuage.plugin.NuagePlugin' {
305 include ::neutron::plugins::nuage
307 include ::neutron::agents::l3
308 include ::neutron::agents::dhcp
309 include ::neutron::agents::metadata
311 file { '/etc/neutron/dnsmasq-neutron.conf':
312 content => hiera('neutron_dnsmasq_options'),
315 notify => Service['neutron-dhcp-service'],
316 require => Package['neutron'],
319 # If the value of core plugin is set to 'midonet',
320 # skip all the ML2 configuration
321 if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
323 class {'::neutron::plugins::midonet':
324 midonet_api_ip => hiera('tripleo::loadbalancer::public_virtual_ip'),
325 keystone_tenant => hiera('neutron::server::auth_tenant'),
326 keystone_password => hiera('neutron::server::auth_password')
330 include ::neutron::plugins::ml2
331 include ::neutron::agents::ml2::ovs
333 if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') {
334 include ::neutron::plugins::ml2::cisco::nexus1000v
336 class { '::neutron::agents::n1kv_vem':
337 n1kv_source => hiera('n1kv_vem_source', undef),
338 n1kv_version => hiera('n1kv_vem_version', undef),
342 n1kv_source => hiera('n1kv_vsm_source', undef),
343 n1kv_version => hiera('n1kv_vsm_version', undef),
344 pacemaker_control => false,
348 if 'cisco_ucsm' in hiera('neutron::plugins::ml2::mechanism_drivers') {
349 include ::neutron::plugins::ml2::cisco::ucsm
351 if 'cisco_nexus' in hiera('neutron::plugins::ml2::mechanism_drivers') {
352 include ::neutron::plugins::ml2::cisco::nexus
353 include ::neutron::plugins::ml2::cisco::type_nexus_vxlan
356 if hiera('neutron_enable_bigswitch_ml2', false) {
357 include ::neutron::plugins::ml2::bigswitch::restproxy
359 neutron_l3_agent_config {
360 'DEFAULT/ovs_use_veth': value => hiera('neutron_ovs_use_veth', false);
362 neutron_dhcp_agent_config {
363 'DEFAULT/ovs_use_veth': value => hiera('neutron_ovs_use_veth', false);
365 Service['neutron-server'] -> Service['neutron-ovs-agent-service']
368 Service['neutron-server'] -> Service['neutron-dhcp-service']
369 Service['neutron-server'] -> Service['neutron-l3']
370 Service['neutron-server'] -> Service['neutron-metadata']
374 include ::cinder::config
375 include ::tripleo::ssl::cinder_config
376 include ::cinder::api
377 include ::cinder::glance
378 include ::cinder::scheduler
379 include ::cinder::volume
380 class { '::cinder::setup_test_volume':
381 size => join([hiera('cinder_lvm_loop_device_size'), 'M']),
384 $cinder_enable_iscsi = hiera('cinder_enable_iscsi_backend', true)
385 if $cinder_enable_iscsi {
386 $cinder_iscsi_backend = 'tripleo_iscsi'
388 cinder::backend::iscsi { $cinder_iscsi_backend :
389 iscsi_ip_address => hiera('cinder_iscsi_ip_address'),
390 iscsi_helper => hiera('cinder_iscsi_helper'),
396 $ceph_pools = hiera('ceph_pools')
397 ceph::pool { $ceph_pools :
398 pg_num => hiera('ceph::profile::params::osd_pool_default_pg_num'),
399 pgp_num => hiera('ceph::profile::params::osd_pool_default_pgp_num'),
400 size => hiera('ceph::profile::params::osd_pool_default_size'),
403 $cinder_pool_requires = [Ceph::Pool[hiera('cinder_rbd_pool_name')]]
406 $cinder_pool_requires = []
409 if hiera('cinder_enable_rbd_backend', false) {
410 $cinder_rbd_backend = 'tripleo_ceph'
412 cinder::backend::rbd { $cinder_rbd_backend :
413 rbd_pool => hiera('cinder_rbd_pool_name'),
414 rbd_user => hiera('ceph_client_user_name'),
415 rbd_secret_uuid => hiera('ceph::profile::params::fsid'),
416 require => $cinder_pool_requires,
420 if hiera('cinder_enable_eqlx_backend', false) {
421 $cinder_eqlx_backend = hiera('cinder::backend::eqlx::volume_backend_name')
423 cinder::backend::eqlx { $cinder_eqlx_backend :
424 volume_backend_name => hiera('cinder::backend::eqlx::volume_backend_name', undef),
425 san_ip => hiera('cinder::backend::eqlx::san_ip', undef),
426 san_login => hiera('cinder::backend::eqlx::san_login', undef),
427 san_password => hiera('cinder::backend::eqlx::san_password', undef),
428 san_thin_provision => hiera('cinder::backend::eqlx::san_thin_provision', undef),
429 eqlx_group_name => hiera('cinder::backend::eqlx::eqlx_group_name', undef),
430 eqlx_pool => hiera('cinder::backend::eqlx::eqlx_pool', undef),
431 eqlx_use_chap => hiera('cinder::backend::eqlx::eqlx_use_chap', undef),
432 eqlx_chap_login => hiera('cinder::backend::eqlx::eqlx_chap_login', undef),
433 eqlx_chap_password => hiera('cinder::backend::eqlx::eqlx_san_password', undef),
437 if hiera('cinder_enable_dellsc_backend', false) {
438 $cinder_dellsc_backend = hiera('cinder::backend::dellsc_iscsi::volume_backend_name')
440 cinder::backend::dellsc_iscsi{ $cinder_dellsc_backend :
441 volume_backend_name => hiera('cinder::backend::dellsc_iscsi::volume_backend_name', undef),
442 san_ip => hiera('cinder::backend::dellsc_iscsi::san_ip', undef),
443 san_login => hiera('cinder::backend::dellsc_iscsi::san_login', undef),
444 san_password => hiera('cinder::backend::dellsc_iscsi::san_password', undef),
445 dell_sc_ssn => hiera('cinder::backend::dellsc_iscsi::dell_sc_ssn', undef),
446 iscsi_ip_address => hiera('cinder::backend::dellsc_iscsi::iscsi_ip_address', undef),
447 iscsi_port => hiera('cinder::backend::dellsc_iscsi::iscsi_port', undef),
448 dell_sc_api_port => hiera('cinder::backend::dellsc_iscsi::dell_sc_api_port', undef),
449 dell_sc_server_folder => hiera('cinder::backend::dellsc_iscsi::dell_sc_server_folder', undef),
450 dell_sc_volume_folder => hiera('cinder::backend::dellsc_iscsi::dell_sc_volume_folder', undef),
454 if hiera('cinder_enable_netapp_backend', false) {
455 $cinder_netapp_backend = hiera('cinder::backend::netapp::title')
457 if hiera('cinder::backend::netapp::nfs_shares', undef) {
458 $cinder_netapp_nfs_shares = split(hiera('cinder::backend::netapp::nfs_shares', undef), ',')
461 cinder::backend::netapp { $cinder_netapp_backend :
462 netapp_login => hiera('cinder::backend::netapp::netapp_login', undef),
463 netapp_password => hiera('cinder::backend::netapp::netapp_password', undef),
464 netapp_server_hostname => hiera('cinder::backend::netapp::netapp_server_hostname', undef),
465 netapp_server_port => hiera('cinder::backend::netapp::netapp_server_port', undef),
466 netapp_size_multiplier => hiera('cinder::backend::netapp::netapp_size_multiplier', undef),
467 netapp_storage_family => hiera('cinder::backend::netapp::netapp_storage_family', undef),
468 netapp_storage_protocol => hiera('cinder::backend::netapp::netapp_storage_protocol', undef),
469 netapp_transport_type => hiera('cinder::backend::netapp::netapp_transport_type', undef),
470 netapp_vfiler => hiera('cinder::backend::netapp::netapp_vfiler', undef),
471 netapp_volume_list => hiera('cinder::backend::netapp::netapp_volume_list', undef),
472 netapp_vserver => hiera('cinder::backend::netapp::netapp_vserver', undef),
473 netapp_partner_backend_name => hiera('cinder::backend::netapp::netapp_partner_backend_name', undef),
474 nfs_shares => $cinder_netapp_nfs_shares,
475 nfs_shares_config => hiera('cinder::backend::netapp::nfs_shares_config', undef),
476 netapp_copyoffload_tool_path => hiera('cinder::backend::netapp::netapp_copyoffload_tool_path', undef),
477 netapp_controller_ips => hiera('cinder::backend::netapp::netapp_controller_ips', undef),
478 netapp_sa_password => hiera('cinder::backend::netapp::netapp_sa_password', undef),
479 netapp_storage_pools => hiera('cinder::backend::netapp::netapp_storage_pools', undef),
480 netapp_eseries_host_type => hiera('cinder::backend::netapp::netapp_eseries_host_type', undef),
481 netapp_webservice_path => hiera('cinder::backend::netapp::netapp_webservice_path', undef),
485 if hiera('cinder_enable_nfs_backend', false) {
486 $cinder_nfs_backend = 'tripleo_nfs'
488 if str2bool($::selinux) {
489 selboolean { 'virt_use_nfs':
492 } -> Package['nfs-utils']
495 package {'nfs-utils': } ->
496 cinder::backend::nfs { $cinder_nfs_backend :
497 nfs_servers => hiera('cinder_nfs_servers'),
498 nfs_mount_options => hiera('cinder_nfs_mount_options',''),
499 nfs_shares_config => '/etc/cinder/shares-nfs.conf',
503 $cinder_enabled_backends = delete_undef_values([$cinder_iscsi_backend, $cinder_rbd_backend, $cinder_eqlx_backend, $cinder_dellsc_backend, $cinder_netapp_backend, $cinder_nfs_backend])
504 class { '::cinder::backends' :
505 enabled_backends => $cinder_enabled_backends,
510 include ::swift::proxy
511 include ::swift::proxy::proxy_logging
512 include ::swift::proxy::healthcheck
513 include ::swift::proxy::cache
514 include ::swift::proxy::keystone
515 include ::swift::proxy::authtoken
516 include ::swift::proxy::staticweb
517 include ::swift::proxy::ratelimit
518 include ::swift::proxy::catch_errors
519 include ::swift::proxy::tempurl
520 include ::swift::proxy::formpost
523 if str2bool(hiera('enable_swift_storage', true)) {
524 class { '::swift::storage::all':
525 mount_check => str2bool(hiera('swift_mount_check')),
527 if(!defined(File['/srv/node'])) {
532 require => Package['openstack-swift'],
535 $swift_components = ['account', 'container', 'object']
536 swift::storage::filter::recon { $swift_components : }
537 swift::storage::filter::healthcheck { $swift_components : }
541 $ceilometer_backend = downcase(hiera('ceilometer_backend'))
542 case $ceilometer_backend {
544 $ceilometer_database_connection = hiera('ceilometer_mysql_conn_string')
547 $ceilometer_database_connection = $ceilometer_mongodb_conn_string
551 include ::ceilometer::config
552 include ::ceilometer::api
553 include ::ceilometer::agent::notification
554 include ::ceilometer::agent::central
555 include ::ceilometer::expirer
556 include ::ceilometer::collector
557 include ::ceilometer::agent::auth
558 class { '::ceilometer::db' :
559 database_connection => $ceilometer_database_connection,
562 Cron <| title == 'ceilometer-expirer' |> { command => "sleep $((\$(od -A n -t d -N 3 /dev/urandom) % 86400)) && ${::ceilometer::params::expirer_command}" }
566 include ::heat::config
568 include ::heat::api_cfn
569 include ::heat::api_cloudwatch
570 include ::heat::engine
574 include ::sahara::service::api
575 include ::sahara::service::engine
578 if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') {
579 $_profile_support = 'cisco'
581 $_profile_support = 'None'
583 $neutron_options = {'profile_support' => $_profile_support }
586 cache_server_ip => hiera('memcache_node_ips', '127.0.0.1'),
587 neutron_options => $neutron_options,
590 $snmpd_user = hiera('snmpd_readonly_user_name')
591 snmp::snmpv3_user { $snmpd_user:
593 authpass => hiera('snmpd_readonly_user_password'),
596 agentaddress => ['udp:161','udp6:[::1]:161'],
597 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' ],
600 hiera_include('controller_classes')
604 if hiera('step') >= 4 {
605 $keystone_enable_db_purge = hiera('keystone_enable_db_purge', true)
606 $nova_enable_db_purge = hiera('nova_enable_db_purge', true)
607 $cinder_enable_db_purge = hiera('cinder_enable_db_purge', true)
609 if $keystone_enable_db_purge {
610 include ::keystone::cron::token_flush
612 if $nova_enable_db_purge {
613 include ::nova::cron::archive_deleted_rows
615 if $cinder_enable_db_purge {
616 include ::cinder::cron::db_purge
620 $package_manifest_name = join(['/var/lib/tripleo/installed-packages/overcloud_controller', hiera('step')])
621 package_manifest{$package_manifest_name: ensure => present}