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 if !str2bool(hiera('enable_package_install', 'false')) {
19 Package { provider => 'norpm' } # provided by tripleo-puppet
22 warning('enable_package_install option not supported.')
27 if hiera('step') >= 1 {
29 create_resources(sysctl::value, hiera('sysctl_settings'), {})
31 $controller_node_ips = split(hiera('controller_node_ips'), ',')
33 class { '::tripleo::loadbalancer' :
34 controller_hosts => $controller_node_ips,
40 if hiera('step') >= 2 {
42 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 class {'::tripleo::redis_notification' :
80 haproxy_monitor_ip => hiera('tripleo::loadbalancer::controller_virtual_ip'),
84 if str2bool(hiera('enable_galera', 'true')) {
85 $mysql_config_file = '/etc/my.cnf.d/galera.cnf'
87 $mysql_config_file = '/etc/my.cnf.d/server.cnf'
90 class { 'mysql::server':
91 config_file => $mysql_config_file,
94 'bind-address' => hiera('mysql_bind_host'),
95 'max_connections' => '1024',
96 'open_files_limit' => '-1',
101 # FIXME: this should only occur on the bootstrap host (ditto for db syncs)
102 # Create all the database schemas
103 # Example DSN format: mysql://user:password@host/dbname
104 $allowed_hosts = ['%',hiera('mysql_bind_host')]
105 $keystone_dsn = split(hiera('keystone::database_connection'), '[@:/?]')
106 class { 'keystone::db::mysql':
107 user => $keystone_dsn[3],
108 password => $keystone_dsn[4],
109 host => $keystone_dsn[5],
110 dbname => $keystone_dsn[6],
111 allowed_hosts => $allowed_hosts,
113 $glance_dsn = split(hiera('glance::api::database_connection'), '[@:/?]')
114 class { 'glance::db::mysql':
115 user => $glance_dsn[3],
116 password => $glance_dsn[4],
117 host => $glance_dsn[5],
118 dbname => $glance_dsn[6],
119 allowed_hosts => $allowed_hosts,
121 $nova_dsn = split(hiera('nova::database_connection'), '[@:/?]')
122 class { 'nova::db::mysql':
123 user => $nova_dsn[3],
124 password => $nova_dsn[4],
125 host => $nova_dsn[5],
126 dbname => $nova_dsn[6],
127 allowed_hosts => $allowed_hosts,
129 $neutron_dsn = split(hiera('neutron::server::database_connection'), '[@:/?]')
130 class { 'neutron::db::mysql':
131 user => $neutron_dsn[3],
132 password => $neutron_dsn[4],
133 host => $neutron_dsn[5],
134 dbname => $neutron_dsn[6],
135 allowed_hosts => $allowed_hosts,
137 $cinder_dsn = split(hiera('cinder::database_connection'), '[@:/?]')
138 class { 'cinder::db::mysql':
139 user => $cinder_dsn[3],
140 password => $cinder_dsn[4],
141 host => $cinder_dsn[5],
142 dbname => $cinder_dsn[6],
143 allowed_hosts => $allowed_hosts,
145 $heat_dsn = split(hiera('heat::database_connection'), '[@:/?]')
146 class { 'heat::db::mysql':
147 user => $heat_dsn[3],
148 password => $heat_dsn[4],
149 host => $heat_dsn[5],
150 dbname => $heat_dsn[6],
151 allowed_hosts => $allowed_hosts,
153 if downcase(hiera('ceilometer_backend')) == 'mysql' {
154 $ceilometer_dsn = split(hiera('ceilometer_mysql_conn_string'), '[@:/?]')
155 class { 'ceilometer::db::mysql':
156 user => $ceilometer_dsn[3],
157 password => $ceilometer_dsn[4],
158 host => $ceilometer_dsn[5],
159 dbname => $ceilometer_dsn[6],
160 allowed_hosts => $allowed_hosts,
164 $rabbit_nodes = hiera('rabbit_node_ips')
165 if count($rabbit_nodes) > 1 {
166 class { '::rabbitmq':
167 config_cluster => true,
168 cluster_nodes => $rabbit_nodes,
169 tcp_keepalive => false,
170 config_kernel_variables => hiera('rabbitmq_kernel_variables'),
171 config_variables => hiera('rabbitmq_config_variables'),
172 environment_variables => hiera('rabbitmq_environment'),
174 rabbitmq_policy { 'ha-all@/':
175 pattern => '^(?!amq\.).*',
184 # pre-install swift here so we can build rings
187 $cinder_enable_rbd_backend = hiera('cinder_enable_rbd_backend', false)
188 $enable_ceph = $cinder_enable_rbd_backend
191 class { 'ceph::profile::params':
192 mon_initial_members => downcase(hiera('ceph_mon_initial_members'))
194 include ::ceph::profile::mon
197 if str2bool(hiera('enable_ceph_storage', 'false')) {
198 include ::ceph::profile::client
199 include ::ceph::profile::osd
204 if hiera('step') >= 3 {
208 #TODO: need a cleanup-keystone-tokens.sh solution here
210 'ec2/driver': value => 'keystone.contrib.ec2.backends.sql.Ec2';
212 file { [ '/etc/keystone/ssl', '/etc/keystone/ssl/certs', '/etc/keystone/ssl/private' ]:
213 ensure => 'directory',
216 require => Package['keystone'],
218 file { '/etc/keystone/ssl/certs/signing_cert.pem':
219 content => hiera('keystone_signing_certificate'),
222 notify => Service['keystone'],
223 require => File['/etc/keystone/ssl/certs'],
225 file { '/etc/keystone/ssl/private/signing_key.pem':
226 content => hiera('keystone_signing_key'),
229 notify => Service['keystone'],
230 require => File['/etc/keystone/ssl/private'],
232 file { '/etc/keystone/ssl/certs/ca.pem':
233 content => hiera('keystone_ca_certificate'),
236 notify => Service['keystone'],
237 require => File['/etc/keystone/ssl/certs'],
240 $glance_backend = downcase(hiera('glance_backend', 'swift'))
241 case $glance_backend {
242 swift: { $glance_store = 'glance.store.swift.Store' }
243 file: { $glance_store = 'glance.store.filesystem.Store' }
244 rbd: { $glance_store = 'glance.store.rbd.Store' }
245 default: { fail('Unrecognized glance_backend parameter.') }
248 # TODO: notifications, scrubber, etc.
250 class { 'glance::api':
251 known_stores => [$glance_store]
253 include ::glance::registry
254 include join(['::glance::backend::', $glance_backend])
257 glance_api_servers => join([hiera('glance_protocol'), '://', hiera('controller_virtual_ip'), ':', hiera('glance_port')]),
262 include ::nova::conductor
263 include ::nova::consoleauth
264 include ::nova::network::neutron
265 include ::nova::vncproxy
266 include ::nova::scheduler
269 include ::neutron::server
270 include ::neutron::agents::l3
271 include ::neutron::agents::dhcp
272 class { 'neutron::agents::metadata':
273 auth_url => join(['http://', hiera('controller_virtual_ip'), ':35357/v2.0']),
276 file { '/etc/neutron/dnsmasq-neutron.conf':
277 content => hiera('neutron_dnsmasq_options'),
280 notify => Service['neutron-dhcp-service'],
281 require => Package['neutron'],
284 class { 'neutron::plugins::ml2':
285 flat_networks => split(hiera('neutron_flat_networks'), ','),
286 tenant_network_types => [hiera('neutron_tenant_network_type')],
287 type_drivers => [hiera('neutron_tenant_network_type')],
289 class { 'neutron::agents::ml2::ovs':
290 bridge_mappings => split(hiera('neutron_bridge_mappings'), ','),
291 tunnel_types => split(hiera('neutron_tunnel_types'), ','),
294 Service['neutron-server'] -> Service['neutron-dhcp-service']
295 Service['neutron-server'] -> Service['neutron-l3']
296 Service['neutron-server'] -> Service['neutron-ovs-agent-service']
297 Service['neutron-server'] -> Service['neutron-metadata']
300 include ::cinder::api
301 include ::cinder::glance
302 include ::cinder::scheduler
303 include ::cinder::volume
304 class {'cinder::setup_test_volume':
305 size => join([hiera('cinder_lvm_loop_device_size'), 'M']),
308 $cinder_enable_iscsi = hiera('cinder_enable_iscsi_backend', true)
309 if $cinder_enable_iscsi {
310 $cinder_iscsi_backend = 'tripleo_iscsi'
312 cinder::backend::iscsi { $cinder_iscsi_backend :
313 iscsi_ip_address => hiera('cinder_iscsi_ip_address'),
314 iscsi_helper => hiera('cinder_iscsi_helper'),
321 pg_num => hiera('ceph::profile::params::osd_pool_default_pg_num'),
322 pgp_num => hiera('ceph::profile::params::osd_pool_default_pgp_num'),
323 size => hiera('ceph::profile::params::osd_pool_default_size'),
326 $ceph_pools = hiera('ceph_pools')
327 ceph::pool { $ceph_pools : }
330 if $cinder_enable_rbd_backend {
331 $cinder_rbd_backend = 'tripleo_ceph'
334 "${cinder_rbd_backend}/host": value => 'hostgroup';
337 cinder::backend::rbd { $cinder_rbd_backend :
338 rbd_pool => 'volumes',
339 rbd_user => 'openstack',
340 rbd_secret_uuid => hiera('ceph::profile::params::fsid'),
341 require => Ceph::Pool['volumes'],
345 $cinder_enabled_backends = delete_undef_values([$cinder_iscsi_backend, $cinder_rbd_backend])
346 class { '::cinder::backends' :
347 enabled_backends => $cinder_enabled_backends,
352 include ::swift::proxy
353 include ::swift::proxy::proxy_logging
354 include ::swift::proxy::healthcheck
355 include ::swift::proxy::cache
356 include ::swift::proxy::keystone
357 include ::swift::proxy::authtoken
358 include ::swift::proxy::staticweb
359 include ::swift::proxy::ceilometer
360 include ::swift::proxy::ratelimit
361 include ::swift::proxy::catch_errors
362 include ::swift::proxy::tempurl
363 include ::swift::proxy::formpost
366 if str2bool(hiera('enable_swift_storage', 'true')) {
367 class {'swift::storage::all':
368 mount_check => str2bool(hiera('swift_mount_check'))
370 if(!defined(File['/srv/node'])) {
375 require => Package['openstack-swift'],
378 $swift_components = ['account', 'container', 'object']
379 swift::storage::filter::recon { $swift_components : }
380 swift::storage::filter::healthcheck { $swift_components : }
384 $ceilometer_backend = downcase(hiera('ceilometer_backend'))
385 case $ceilometer_backend {
387 $ceilometer_database_connection = hiera('ceilometer_mysql_conn_string')
390 $ceilometer_database_connection = $ceilometer_mongodb_conn_string
394 include ::ceilometer::api
395 include ::ceilometer::agent::notification
396 include ::ceilometer::agent::central
397 include ::ceilometer::alarm::notifier
398 include ::ceilometer::alarm::evaluator
399 include ::ceilometer::expirer
400 include ::ceilometer::collector
401 class { '::ceilometer::db' :
402 database_connection => $ceilometer_database_connection,
404 class { 'ceilometer::agent::auth':
405 auth_url => join(['http://', hiera('controller_virtual_ip'), ':5000/v2.0']),
408 Cron <| title == 'ceilometer-expirer' |> { command => "sleep $((\$(od -A n -t d -N 3 /dev/urandom) % 86400)) && ${::ceilometer::params::expirer_command}" }
413 include ::heat::api_cfn
414 include ::heat::api_cloudwatch
415 include ::heat::engine
418 $vhost_params = { add_listen => false }
420 cache_server_ip => hiera('memcache_node_ips', '127.0.0.1'),
421 vhost_extra_params => $vhost_params,
424 $snmpd_user = hiera('snmpd_readonly_user_name')
425 snmp::snmpv3_user { $snmpd_user:
427 authpass => hiera('snmpd_readonly_user_password'),
430 agentaddress => ['udp:161','udp6:[::1]:161'],
431 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' ],