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
18 if hiera('step') >= 1 {
20 create_resources(sysctl::value, hiera('sysctl_settings'), {})
22 $controller_node_ips = split(hiera('controller_node_ips'), ',')
24 class { '::tripleo::loadbalancer' :
25 controller_hosts => $controller_node_ips,
31 if hiera('step') >= 2 {
33 if count(hiera('ntp::servers')) > 0 {
38 if downcase(hiera('ceilometer_backend')) == 'mongodb' {
39 include ::mongodb::globals
41 include ::mongodb::server
42 $mongo_node_ips_with_port = suffix(hiera('mongo_node_ips'), ':27017')
43 $mongo_node_string = join($mongo_node_ips_with_port, ',')
45 $mongodb_replset = hiera('mongodb::server::replset')
46 $ceilometer_mongodb_conn_string = "mongodb://${mongo_node_string}/ceilometer?replicaSet=${mongodb_replset}"
47 if downcase(hiera('bootstrap_nodeid')) == $::hostname {
48 mongodb_replset { $mongodb_replset :
49 members => $mongo_node_ips_with_port,
55 $redis_node_ips = hiera('redis_node_ips')
56 $redis_master_hostname = downcase(hiera('bootstrap_nodeid'))
58 if $redis_master_hostname == $::hostname {
61 $slaveof = "${redis_master_hostname} 6379"
67 if count($redis_node_ips) > 1 {
68 Class['::tripleo::redis_notification'] -> Service['redis-sentinel']
69 include ::redis::sentinel
70 include ::tripleo::redis_notification
73 if str2bool(hiera('enable_galera', 'true')) {
74 $mysql_config_file = '/etc/my.cnf.d/galera.cnf'
76 $mysql_config_file = '/etc/my.cnf.d/server.cnf'
79 class { 'mysql::server':
80 config_file => $mysql_config_file,
83 'bind-address' => hiera('mysql_bind_host'),
84 'max_connections' => hiera('mysql_max_connections'),
85 'open_files_limit' => '-1',
90 # FIXME: this should only occur on the bootstrap host (ditto for db syncs)
91 # Create all the database schemas
92 # Example DSN format: mysql://user:password@host/dbname
93 $allowed_hosts = ['%',hiera('mysql_bind_host')]
94 $keystone_dsn = split(hiera('keystone::database_connection'), '[@:/?]')
95 class { 'keystone::db::mysql':
96 user => $keystone_dsn[3],
97 password => $keystone_dsn[4],
98 host => $keystone_dsn[5],
99 dbname => $keystone_dsn[6],
100 allowed_hosts => $allowed_hosts,
102 $glance_dsn = split(hiera('glance::api::database_connection'), '[@:/?]')
103 class { 'glance::db::mysql':
104 user => $glance_dsn[3],
105 password => $glance_dsn[4],
106 host => $glance_dsn[5],
107 dbname => $glance_dsn[6],
108 allowed_hosts => $allowed_hosts,
110 $nova_dsn = split(hiera('nova::database_connection'), '[@:/?]')
111 class { 'nova::db::mysql':
112 user => $nova_dsn[3],
113 password => $nova_dsn[4],
114 host => $nova_dsn[5],
115 dbname => $nova_dsn[6],
116 allowed_hosts => $allowed_hosts,
118 $neutron_dsn = split(hiera('neutron::server::database_connection'), '[@:/?]')
119 class { 'neutron::db::mysql':
120 user => $neutron_dsn[3],
121 password => $neutron_dsn[4],
122 host => $neutron_dsn[5],
123 dbname => $neutron_dsn[6],
124 allowed_hosts => $allowed_hosts,
126 $cinder_dsn = split(hiera('cinder::database_connection'), '[@:/?]')
127 class { 'cinder::db::mysql':
128 user => $cinder_dsn[3],
129 password => $cinder_dsn[4],
130 host => $cinder_dsn[5],
131 dbname => $cinder_dsn[6],
132 allowed_hosts => $allowed_hosts,
134 $heat_dsn = split(hiera('heat::database_connection'), '[@:/?]')
135 class { 'heat::db::mysql':
136 user => $heat_dsn[3],
137 password => $heat_dsn[4],
138 host => $heat_dsn[5],
139 dbname => $heat_dsn[6],
140 allowed_hosts => $allowed_hosts,
142 if downcase(hiera('ceilometer_backend')) == 'mysql' {
143 $ceilometer_dsn = split(hiera('ceilometer_mysql_conn_string'), '[@:/?]')
144 class { 'ceilometer::db::mysql':
145 user => $ceilometer_dsn[3],
146 password => $ceilometer_dsn[4],
147 host => $ceilometer_dsn[5],
148 dbname => $ceilometer_dsn[6],
149 allowed_hosts => $allowed_hosts,
153 $rabbit_nodes = hiera('rabbit_node_ips')
154 if count($rabbit_nodes) > 1 {
155 class { '::rabbitmq':
156 config_cluster => true,
157 cluster_nodes => $rabbit_nodes,
158 tcp_keepalive => false,
159 config_kernel_variables => hiera('rabbitmq_kernel_variables'),
160 config_variables => hiera('rabbitmq_config_variables'),
161 environment_variables => hiera('rabbitmq_environment'),
163 rabbitmq_policy { 'ha-all@/':
164 pattern => '^(?!amq\.).*',
173 # pre-install swift here so we can build rings
176 $cinder_enable_rbd_backend = hiera('cinder_enable_rbd_backend', false)
177 $enable_ceph = $cinder_enable_rbd_backend
180 class { 'ceph::profile::params':
181 mon_initial_members => downcase(hiera('ceph_mon_initial_members'))
183 include ::ceph::profile::mon
186 if str2bool(hiera('enable_ceph_storage', 'false')) {
187 if str2bool(hiera('ceph_osd_selinux_permissive', true)) {
188 exec { 'set selinux to permissive on boot':
189 command => "sed -ie 's/^SELINUX=.*/SELINUX=permissive/' /etc/selinux/config",
190 onlyif => "test -f /etc/selinux/config && ! grep '^SELINUX=permissive' /etc/selinux/config",
191 path => ["/usr/bin", "/usr/sbin"],
194 exec { 'set selinux to permissive':
195 command => "setenforce 0",
196 onlyif => "which setenforce && getenforce | grep -i 'enforcing'",
197 path => ["/usr/bin", "/usr/sbin"],
198 } -> Class['ceph::profile::osd']
201 include ::ceph::profile::client
202 include ::ceph::profile::osd
207 if hiera('step') >= 3 {
211 #TODO: need a cleanup-keystone-tokens.sh solution here
213 'ec2/driver': value => 'keystone.contrib.ec2.backends.sql.Ec2';
215 file { [ '/etc/keystone/ssl', '/etc/keystone/ssl/certs', '/etc/keystone/ssl/private' ]:
216 ensure => 'directory',
219 require => Package['keystone'],
221 file { '/etc/keystone/ssl/certs/signing_cert.pem':
222 content => hiera('keystone_signing_certificate'),
225 notify => Service['keystone'],
226 require => File['/etc/keystone/ssl/certs'],
228 file { '/etc/keystone/ssl/private/signing_key.pem':
229 content => hiera('keystone_signing_key'),
232 notify => Service['keystone'],
233 require => File['/etc/keystone/ssl/private'],
235 file { '/etc/keystone/ssl/certs/ca.pem':
236 content => hiera('keystone_ca_certificate'),
239 notify => Service['keystone'],
240 require => File['/etc/keystone/ssl/certs'],
243 $glance_backend = downcase(hiera('glance_backend', 'swift'))
244 case $glance_backend {
245 swift: { $backend_store = 'glance.store.swift.Store' }
246 file: { $backend_store = 'glance.store.filesystem.Store' }
247 rbd: { $backend_store = 'glance.store.rbd.Store' }
248 default: { fail('Unrecognized glance_backend parameter.') }
250 $http_store = ['glance.store.http.Store']
251 $glance_store = concat($http_store, $backend_store)
253 # TODO: notifications, scrubber, etc.
255 class { 'glance::api':
256 known_stores => $glance_store
258 include ::glance::registry
259 include join(['::glance::backend::', $glance_backend])
262 memcached_servers => suffix(hiera('memcache_node_ips'), ':11211'),
264 include ::nova::config
267 include ::nova::conductor
268 include ::nova::consoleauth
269 include ::nova::network::neutron
270 include ::nova::vncproxy
271 include ::nova::scheduler
274 include ::neutron::server
275 include ::neutron::agents::l3
276 include ::neutron::agents::dhcp
277 include ::neutron::agents::metadata
279 file { '/etc/neutron/dnsmasq-neutron.conf':
280 content => hiera('neutron_dnsmasq_options'),
283 notify => Service['neutron-dhcp-service'],
284 require => Package['neutron'],
287 class { 'neutron::plugins::ml2':
288 flat_networks => split(hiera('neutron_flat_networks'), ','),
289 tenant_network_types => [hiera('neutron_tenant_network_type')],
291 class { 'neutron::agents::ml2::ovs':
292 bridge_mappings => split(hiera('neutron_bridge_mappings'), ','),
293 tunnel_types => split(hiera('neutron_tunnel_types'), ','),
296 Service['neutron-server'] -> Service['neutron-dhcp-service']
297 Service['neutron-server'] -> Service['neutron-l3']
298 Service['neutron-server'] -> Service['neutron-ovs-agent-service']
299 Service['neutron-server'] -> Service['neutron-metadata']
302 include ::cinder::api
303 include ::cinder::glance
304 include ::cinder::scheduler
305 include ::cinder::volume
306 class {'cinder::setup_test_volume':
307 size => join([hiera('cinder_lvm_loop_device_size'), 'M']),
310 $cinder_enable_iscsi = hiera('cinder_enable_iscsi_backend', true)
311 if $cinder_enable_iscsi {
312 $cinder_iscsi_backend = 'tripleo_iscsi'
314 cinder::backend::iscsi { $cinder_iscsi_backend :
315 iscsi_ip_address => hiera('cinder_iscsi_ip_address'),
316 iscsi_helper => hiera('cinder_iscsi_helper'),
323 pg_num => hiera('ceph::profile::params::osd_pool_default_pg_num'),
324 pgp_num => hiera('ceph::profile::params::osd_pool_default_pgp_num'),
325 size => hiera('ceph::profile::params::osd_pool_default_size'),
328 $ceph_pools = hiera('ceph_pools')
329 ceph::pool { $ceph_pools : }
332 if $cinder_enable_rbd_backend {
333 $cinder_rbd_backend = 'tripleo_ceph'
336 "${cinder_rbd_backend}/host": value => 'hostgroup';
339 cinder::backend::rbd { $cinder_rbd_backend :
340 rbd_pool => 'volumes',
341 rbd_user => 'openstack',
342 rbd_secret_uuid => hiera('ceph::profile::params::fsid'),
343 require => Ceph::Pool['volumes'],
347 if hiera('cinder_enable_netapp_backend', false) {
348 $cinder_netapp_backend = hiera('cinder::backend::netapp::title')
351 "${cinder_netapp_backend}/host": value => 'hostgroup';
354 if hiera('cinder::backend::netapp::nfs_shares', undef) {
355 $cinder_netapp_nfs_shares = split(hiera('cinder::backend::netapp::nfs_shares', undef), ',')
358 cinder::backend::netapp { $cinder_netapp_backend :
359 netapp_login => hiera('cinder::backend::netapp::netapp_login', undef),
360 netapp_password => hiera('cinder::backend::netapp::netapp_password', undef),
361 netapp_server_hostname => hiera('cinder::backend::netapp::netapp_server_hostname', undef),
362 netapp_server_port => hiera('cinder::backend::netapp::netapp_server_port', undef),
363 netapp_size_multiplier => hiera('cinder::backend::netapp::netapp_size_multiplier', undef),
364 netapp_storage_family => hiera('cinder::backend::netapp::netapp_storage_family', undef),
365 netapp_storage_protocol => hiera('cinder::backend::netapp::netapp_storage_protocol', undef),
366 netapp_transport_type => hiera('cinder::backend::netapp::netapp_transport_type', undef),
367 netapp_vfiler => hiera('cinder::backend::netapp::netapp_vfiler', undef),
368 netapp_volume_list => hiera('cinder::backend::netapp::netapp_volume_list', undef),
369 netapp_vserver => hiera('cinder::backend::netapp::netapp_vserver', undef),
370 netapp_partner_backend_name => hiera('cinder::backend::netapp::netapp_partner_backend_name', undef),
371 nfs_shares => $cinder_netapp_nfs_shares,
372 nfs_shares_config => hiera('cinder::backend::netapp::nfs_shares_config', undef),
373 netapp_copyoffload_tool_path => hiera('cinder::backend::netapp::netapp_copyoffload_tool_path', undef),
374 netapp_controller_ips => hiera('cinder::backend::netapp::netapp_controller_ips', undef),
375 netapp_sa_password => hiera('cinder::backend::netapp::netapp_sa_password', undef),
376 netapp_storage_pools => hiera('cinder::backend::netapp::netapp_storage_pools', undef),
377 netapp_eseries_host_type => hiera('cinder::backend::netapp::netapp_eseries_host_type', undef),
378 netapp_webservice_path => hiera('cinder::backend::netapp::netapp_webservice_path', undef),
382 if hiera('cinder_enable_nfs_backend', false) {
383 $cinder_nfs_backend = 'tripleo_nfs'
385 if ($::selinux != "false") {
386 selboolean { 'virt_use_nfs':
389 } -> Package['nfs-utils']
392 package {'nfs-utils': } ->
393 cinder::backend::nfs { $cinder_nfs_backend :
394 nfs_servers => hiera('cinder_nfs_servers'),
395 nfs_mount_options => hiera('cinder_nfs_mount_options'),
396 nfs_shares_config => '/etc/cinder/shares-nfs.conf',
400 $cinder_enabled_backends = delete_undef_values([$cinder_iscsi_backend, $cinder_rbd_backend, $cinder_netapp_backend, $cinder_nfs_backend])
401 class { '::cinder::backends' :
402 enabled_backends => $cinder_enabled_backends,
407 include ::swift::proxy
408 include ::swift::proxy::proxy_logging
409 include ::swift::proxy::healthcheck
410 include ::swift::proxy::cache
411 include ::swift::proxy::keystone
412 include ::swift::proxy::authtoken
413 include ::swift::proxy::staticweb
414 include ::swift::proxy::ratelimit
415 include ::swift::proxy::catch_errors
416 include ::swift::proxy::tempurl
417 include ::swift::proxy::formpost
420 if str2bool(hiera('enable_swift_storage', 'true')) {
421 class {'swift::storage::all':
422 mount_check => str2bool(hiera('swift_mount_check'))
424 if(!defined(File['/srv/node'])) {
429 require => Package['openstack-swift'],
432 $swift_components = ['account', 'container', 'object']
433 swift::storage::filter::recon { $swift_components : }
434 swift::storage::filter::healthcheck { $swift_components : }
438 $ceilometer_backend = downcase(hiera('ceilometer_backend'))
439 case $ceilometer_backend {
441 $ceilometer_database_connection = hiera('ceilometer_mysql_conn_string')
444 $ceilometer_database_connection = $ceilometer_mongodb_conn_string
448 include ::ceilometer::api
449 include ::ceilometer::agent::notification
450 include ::ceilometer::agent::central
451 include ::ceilometer::alarm::notifier
452 include ::ceilometer::alarm::evaluator
453 include ::ceilometer::expirer
454 include ::ceilometer::collector
455 include ceilometer::agent::auth
456 class { '::ceilometer::db' :
457 database_connection => $ceilometer_database_connection,
460 Cron <| title == 'ceilometer-expirer' |> { command => "sleep $((\$(od -A n -t d -N 3 /dev/urandom) % 86400)) && ${::ceilometer::params::expirer_command}" }
465 include ::heat::api_cfn
466 include ::heat::api_cloudwatch
467 include ::heat::engine
470 $vhost_params = { add_listen => false }
472 cache_server_ip => hiera('memcache_node_ips', '127.0.0.1'),
473 vhost_extra_params => $vhost_params,
476 $snmpd_user = hiera('snmpd_readonly_user_name')
477 snmp::snmpv3_user { $snmpd_user:
479 authpass => hiera('snmpd_readonly_user_password'),
482 agentaddress => ['udp:161','udp6:[::1]:161'],
483 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' ],
486 hiera_include('controller_classes')
490 if hiera('step') >= 4 {
491 include ::keystone::cron::token_flush