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 class { '::mysql::server':
87 config_file => $mysql_config_file,
90 'bind-address' => hiera('mysql_bind_host'),
91 'max_connections' => hiera('mysql_max_connections'),
92 'open_files_limit' => '-1',
95 remove_default_accounts => true,
98 # FIXME: this should only occur on the bootstrap host (ditto for db syncs)
99 # Create all the database schemas
100 include ::keystone::db::mysql
101 include ::glance::db::mysql
102 include ::nova::db::mysql
103 include ::neutron::db::mysql
104 include ::cinder::db::mysql
105 include ::heat::db::mysql
106 include ::sahara::db::mysql
107 if downcase(hiera('ceilometer_backend')) == 'mysql' {
108 include ::ceilometer::db::mysql
111 $rabbit_nodes = hiera('rabbit_node_ips')
112 if count($rabbit_nodes) > 1 {
113 class { '::rabbitmq':
114 config_cluster => true,
115 cluster_nodes => $rabbit_nodes,
116 tcp_keepalive => false,
117 config_kernel_variables => hiera('rabbitmq_kernel_variables'),
118 config_variables => hiera('rabbitmq_config_variables'),
119 environment_variables => hiera('rabbitmq_environment'),
121 rabbitmq_policy { 'ha-all@/':
122 pattern => '^(?!amq\.).*',
131 # pre-install swift here so we can build rings
134 $enable_ceph = hiera('ceph_storage_count', 0) > 0 or hiera('enable_ceph_storage', false)
137 class { '::ceph::profile::params':
138 mon_initial_members => downcase(hiera('ceph_mon_initial_members')),
140 include ::ceph::profile::mon
143 if str2bool(hiera('enable_ceph_storage', false)) {
144 if str2bool(hiera('ceph_osd_selinux_permissive', true)) {
145 exec { 'set selinux to permissive on boot':
146 command => "sed -ie 's/^SELINUX=.*/SELINUX=permissive/' /etc/selinux/config",
147 onlyif => "test -f /etc/selinux/config && ! grep '^SELINUX=permissive' /etc/selinux/config",
148 path => ['/usr/bin', '/usr/sbin'],
151 exec { 'set selinux to permissive':
152 command => 'setenforce 0',
153 onlyif => "which setenforce && getenforce | grep -i 'enforcing'",
154 path => ['/usr/bin', '/usr/sbin'],
155 } -> Class['ceph::profile::osd']
158 include ::ceph::profile::osd
161 if str2bool(hiera('enable_external_ceph', false)) {
162 include ::ceph::profile::client
167 if hiera('step') >= 3 {
170 include ::keystone::config
171 include ::keystone::roles::admin
172 include ::keystone::endpoint
174 #TODO: need a cleanup-keystone-tokens.sh solution here
176 file { [ '/etc/keystone/ssl', '/etc/keystone/ssl/certs', '/etc/keystone/ssl/private' ]:
177 ensure => 'directory',
180 require => Package['keystone'],
182 file { '/etc/keystone/ssl/certs/signing_cert.pem':
183 content => hiera('keystone_signing_certificate'),
186 notify => Service['keystone'],
187 require => File['/etc/keystone/ssl/certs'],
189 file { '/etc/keystone/ssl/private/signing_key.pem':
190 content => hiera('keystone_signing_key'),
193 notify => Service['keystone'],
194 require => File['/etc/keystone/ssl/private'],
196 file { '/etc/keystone/ssl/certs/ca.pem':
197 content => hiera('keystone_ca_certificate'),
200 notify => Service['keystone'],
201 require => File['/etc/keystone/ssl/certs'],
204 $glance_backend = downcase(hiera('glance_backend', 'swift'))
205 case $glance_backend {
206 'swift': { $backend_store = 'glance.store.swift.Store' }
207 'file': { $backend_store = 'glance.store.filesystem.Store' }
208 'rbd': { $backend_store = 'glance.store.rbd.Store' }
209 default: { fail('Unrecognized glance_backend parameter.') }
211 $http_store = ['glance.store.http.Store']
212 $glance_store = concat($http_store, $backend_store)
214 # TODO: notifications, scrubber, etc.
216 class { '::glance::api':
217 known_stores => $glance_store,
219 include ::glance::registry
220 include join(['::glance::backend::', $glance_backend])
223 memcached_servers => suffix(hiera('memcache_node_ips'), ':11211'),
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 zookeeper_client_ip => $ipaddress,
246 zookeeper_hostnames => hiera('controller_node_names')
250 # Run cassandra in the controller if configured
251 if hiera('enable_cassandra_on_controller') {
252 class {'::tripleo::cluster::cassandra':
253 cassandra_servers => $cassandra_node_ips,
254 cassandra_ip => $ipaddress
258 class {'::tripleo::network::midonet::agent':
259 zookeeper_servers => $zookeeper_node_ips,
260 cassandra_seeds => $cassandra_node_ips
263 class {'::tripleo::network::midonet::api':
264 zookeeper_servers => $zookeeper_node_ips,
266 keystone_ip => $ipaddress,
267 keystone_admin_token => hiera('keystone::admin_token'),
268 bind_address => $ipaddress,
269 admin_password => hiera('admin_password')
272 # TODO: find a way to get an empty list from hiera
274 service_plugins => []
284 include ::neutron::server
285 include ::neutron::server::notifications
287 # If the value of core plugin is set to 'nuage' or 'opencontrail',
288 # include nuage or opencontrail core plugins, and it does not
289 # need the l3, dhcp and metadata agents
290 if hiera('neutron::core_plugin') == 'neutron.plugins.nuage.plugin.NuagePlugin' {
291 include ::neutron::plugins::nuage
292 } elsif hiera('neutron::core_plugin') == 'neutron_plugin_contrail.plugins.opencontrail.contrail_plugin.NeutronPluginContrailCoreV2' {
293 include ::neutron::plugins::opencontrail
295 include ::neutron::agents::l3
296 include ::neutron::agents::dhcp
297 include ::neutron::agents::metadata
299 file { '/etc/neutron/dnsmasq-neutron.conf':
300 content => hiera('neutron_dnsmasq_options'),
303 notify => Service['neutron-dhcp-service'],
304 require => Package['neutron'],
307 # If the value of core plugin is set to 'midonet',
308 # skip all the ML2 configuration
309 if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
311 class {'::neutron::plugins::midonet':
312 midonet_api_ip => $ipaddress,
313 keystone_tenant => hiera('neutron::server::auth_tenant'),
314 keystone_password => hiera('neutron::server::auth_password')
318 include ::neutron::plugins::ml2
319 include ::neutron::agents::ml2::ovs
321 if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') {
322 include ::neutron::plugins::ml2::cisco::nexus1000v
324 class { '::neutron::agents::n1kv_vem':
325 n1kv_source => hiera('n1kv_vem_source', undef),
326 n1kv_version => hiera('n1kv_vem_version', undef),
330 n1kv_source => hiera('n1kv_vsm_source', undef),
331 n1kv_version => hiera('n1kv_vsm_version', undef),
332 pacemaker_control => false,
336 if 'cisco_ucsm' in hiera('neutron::plugins::ml2::mechanism_drivers') {
337 include ::neutron::plugins::ml2::cisco::ucsm
339 if 'cisco_nexus' in hiera('neutron::plugins::ml2::mechanism_drivers') {
340 include ::neutron::plugins::ml2::cisco::nexus
341 include ::neutron::plugins::ml2::cisco::type_nexus_vxlan
344 if hiera('neutron_enable_bigswitch_ml2', false) {
345 include ::neutron::plugins::ml2::bigswitch::restproxy
347 neutron_l3_agent_config {
348 'DEFAULT/ovs_use_veth': value => hiera('neutron_ovs_use_veth', false);
350 neutron_dhcp_agent_config {
351 'DEFAULT/ovs_use_veth': value => hiera('neutron_ovs_use_veth', false);
353 Service['neutron-server'] -> Service['neutron-ovs-agent-service']
356 Service['neutron-server'] -> Service['neutron-dhcp-service']
357 Service['neutron-server'] -> Service['neutron-l3']
358 Service['neutron-server'] -> Service['neutron-metadata']
362 include ::cinder::api
363 include ::cinder::glance
364 include ::cinder::scheduler
365 include ::cinder::volume
366 class { '::cinder::setup_test_volume':
367 size => join([hiera('cinder_lvm_loop_device_size'), 'M']),
370 $cinder_enable_iscsi = hiera('cinder_enable_iscsi_backend', true)
371 if $cinder_enable_iscsi {
372 $cinder_iscsi_backend = 'tripleo_iscsi'
374 cinder::backend::iscsi { $cinder_iscsi_backend :
375 iscsi_ip_address => hiera('cinder_iscsi_ip_address'),
376 iscsi_helper => hiera('cinder_iscsi_helper'),
382 $ceph_pools = hiera('ceph_pools')
383 ceph::pool { $ceph_pools :
384 pg_num => hiera('ceph::profile::params::osd_pool_default_pg_num'),
385 pgp_num => hiera('ceph::profile::params::osd_pool_default_pgp_num'),
386 size => hiera('ceph::profile::params::osd_pool_default_size'),
389 $cinder_pool_requires = [Ceph::Pool[hiera('cinder_rbd_pool_name')]]
392 $cinder_pool_requires = []
395 if hiera('cinder_enable_rbd_backend', false) {
396 $cinder_rbd_backend = 'tripleo_ceph'
398 cinder::backend::rbd { $cinder_rbd_backend :
399 rbd_pool => hiera('cinder_rbd_pool_name'),
400 rbd_user => hiera('ceph_client_user_name'),
401 rbd_secret_uuid => hiera('ceph::profile::params::fsid'),
402 require => $cinder_pool_requires,
406 if hiera('cinder_enable_eqlx_backend', false) {
407 $cinder_eqlx_backend = hiera('cinder::backend::eqlx::volume_backend_name')
410 "${cinder_eqlx_backend}/host": value => 'hostgroup';
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_lpool', 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')
431 "${cinder_dellsc_backend}/host": value => 'hostgroup';
434 cinder::backend::dellsc_iscsi{ $cinder_dellsc_backend :
435 volume_backend_name => hiera('cinder::backend::dellsc_iscsi::volume_backend_name', undef),
436 san_ip => hiera('cinder::backend::dellsc_iscsi::san_ip', undef),
437 san_login => hiera('cinder::backend::dellsc_iscsi::san_login', undef),
438 san_password => hiera('cinder::backend::dellsc_iscsi::san_password', undef),
439 dell_sc_ssn => hiera('cinder::backend::dellsc_iscsi::dell_sc_ssn', undef),
440 iscsi_ip_address => hiera('cinder::backend::dellsc_iscsi::iscsi_ip_address', undef),
441 iscsi_port => hiera('cinder::backend::dellsc_iscsi::iscsi_port', undef),
442 dell_sc_port => hiera('cinder::backend::dellsc_iscsi::dell_sc_port', undef),
443 dell_sc_server_folder => hiera('cinder::backend::dellsc_iscsi::dell_sc_server_folder', undef),
444 dell_sc_volume_folder => hiera('cinder::backend::dellsc_iscsi::dell_sc_volume_folder', undef),
448 if hiera('cinder_enable_netapp_backend', false) {
449 $cinder_netapp_backend = hiera('cinder::backend::netapp::title')
452 "${cinder_netapp_backend}/host": value => 'hostgroup';
455 if hiera('cinder::backend::netapp::nfs_shares', undef) {
456 $cinder_netapp_nfs_shares = split(hiera('cinder::backend::netapp::nfs_shares', undef), ',')
459 cinder::backend::netapp { $cinder_netapp_backend :
460 netapp_login => hiera('cinder::backend::netapp::netapp_login', undef),
461 netapp_password => hiera('cinder::backend::netapp::netapp_password', undef),
462 netapp_server_hostname => hiera('cinder::backend::netapp::netapp_server_hostname', undef),
463 netapp_server_port => hiera('cinder::backend::netapp::netapp_server_port', undef),
464 netapp_size_multiplier => hiera('cinder::backend::netapp::netapp_size_multiplier', undef),
465 netapp_storage_family => hiera('cinder::backend::netapp::netapp_storage_family', undef),
466 netapp_storage_protocol => hiera('cinder::backend::netapp::netapp_storage_protocol', undef),
467 netapp_transport_type => hiera('cinder::backend::netapp::netapp_transport_type', undef),
468 netapp_vfiler => hiera('cinder::backend::netapp::netapp_vfiler', undef),
469 netapp_volume_list => hiera('cinder::backend::netapp::netapp_volume_list', undef),
470 netapp_vserver => hiera('cinder::backend::netapp::netapp_vserver', undef),
471 netapp_partner_backend_name => hiera('cinder::backend::netapp::netapp_partner_backend_name', undef),
472 nfs_shares => $cinder_netapp_nfs_shares,
473 nfs_shares_config => hiera('cinder::backend::netapp::nfs_shares_config', undef),
474 netapp_copyoffload_tool_path => hiera('cinder::backend::netapp::netapp_copyoffload_tool_path', undef),
475 netapp_controller_ips => hiera('cinder::backend::netapp::netapp_controller_ips', undef),
476 netapp_sa_password => hiera('cinder::backend::netapp::netapp_sa_password', undef),
477 netapp_storage_pools => hiera('cinder::backend::netapp::netapp_storage_pools', undef),
478 netapp_eseries_host_type => hiera('cinder::backend::netapp::netapp_eseries_host_type', undef),
479 netapp_webservice_path => hiera('cinder::backend::netapp::netapp_webservice_path', undef),
483 if hiera('cinder_enable_nfs_backend', false) {
484 $cinder_nfs_backend = 'tripleo_nfs'
486 if str2bool($::selinux) {
487 selboolean { 'virt_use_nfs':
490 } -> Package['nfs-utils']
493 package {'nfs-utils': } ->
494 cinder::backend::nfs { $cinder_nfs_backend :
495 nfs_servers => hiera('cinder_nfs_servers'),
496 nfs_mount_options => hiera('cinder_nfs_mount_options',''),
497 nfs_shares_config => '/etc/cinder/shares-nfs.conf',
501 $cinder_enabled_backends = delete_undef_values([$cinder_iscsi_backend, $cinder_rbd_backend, $cinder_eqlx_backend, $cinder_dellsc_backend, $cinder_netapp_backend, $cinder_nfs_backend])
502 class { '::cinder::backends' :
503 enabled_backends => $cinder_enabled_backends,
508 include ::swift::proxy
509 include ::swift::proxy::proxy_logging
510 include ::swift::proxy::healthcheck
511 include ::swift::proxy::cache
512 include ::swift::proxy::keystone
513 include ::swift::proxy::authtoken
514 include ::swift::proxy::staticweb
515 include ::swift::proxy::ratelimit
516 include ::swift::proxy::catch_errors
517 include ::swift::proxy::tempurl
518 include ::swift::proxy::formpost
521 if str2bool(hiera('enable_swift_storage', true)) {
522 class { '::swift::storage::all':
523 mount_check => str2bool(hiera('swift_mount_check')),
525 if(!defined(File['/srv/node'])) {
530 require => Package['openstack-swift'],
533 $swift_components = ['account', 'container', 'object']
534 swift::storage::filter::recon { $swift_components : }
535 swift::storage::filter::healthcheck { $swift_components : }
539 $ceilometer_backend = downcase(hiera('ceilometer_backend'))
540 case $ceilometer_backend {
542 $ceilometer_database_connection = hiera('ceilometer_mysql_conn_string')
545 $ceilometer_database_connection = $ceilometer_mongodb_conn_string
549 include ::ceilometer::config
550 include ::ceilometer::api
551 include ::ceilometer::agent::notification
552 include ::ceilometer::agent::central
553 include ::ceilometer::expirer
554 include ::ceilometer::collector
555 include ::ceilometer::agent::auth
556 class { '::ceilometer::db' :
557 database_connection => $ceilometer_database_connection,
560 Cron <| title == 'ceilometer-expirer' |> { command => "sleep $((\$(od -A n -t d -N 3 /dev/urandom) % 86400)) && ${::ceilometer::params::expirer_command}" }
565 include ::heat::api_cfn
566 include ::heat::api_cloudwatch
567 include ::heat::engine
571 include ::sahara::service::api
572 include ::sahara::service::engine
575 if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') {
576 $_profile_support = 'cisco'
578 $_profile_support = 'None'
580 $neutron_options = {'profile_support' => $_profile_support }
583 cache_server_ip => hiera('memcache_node_ips', '127.0.0.1'),
584 neutron_options => $neutron_options,
587 $snmpd_user = hiera('snmpd_readonly_user_name')
588 snmp::snmpv3_user { $snmpd_user:
590 authpass => hiera('snmpd_readonly_user_password'),
593 agentaddress => ['udp:161','udp6:[::1]:161'],
594 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' ],
597 hiera_include('controller_classes')
601 if hiera('step') >= 4 {
602 $keystone_enable_db_purge = hiera('keystone_enable_db_purge', true)
603 $nova_enable_db_purge = hiera('nova_enable_db_purge', true)
604 $cinder_enable_db_purge = hiera('cinder_enable_db_purge', true)
606 if $keystone_enable_db_purge {
607 include ::keystone::cron::token_flush
609 if $nova_enable_db_purge {
610 include ::nova::cron::archive_deleted_rows
612 if $cinder_enable_db_purge {
613 include ::cinder::cron::db_purge
617 $package_manifest_name = join(['/var/lib/tripleo/installed-packages/overcloud_controller', hiera('step')])
618 package_manifest{$package_manifest_name: ensure => present}