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 = split(hiera('mongo_node_ips'), ',')
52 $mongo_node_ips_with_port = suffix($mongo_node_ips, ':27017')
53 $mongo_node_string = join($mongo_node_ips_with_port, ',')
55 $mongodb_replset = hiera('mongodb::server::replset')
56 $ceilometer_mongodb_conn_string = "mongodb://${mongo_node_string}/ceilometer?replicaSet=${mongodb_replset}"
57 if downcase(hiera('bootstrap_nodeid')) == $::hostname {
58 mongodb_replset { $mongodb_replset :
59 members => $mongo_node_ips_with_port,
65 $redis_node_ips = split(hiera('redis_node_ips'), ',')
66 $redis_master_hostname = downcase(hiera('bootstrap_nodeid'))
68 if $redis_master_hostname == $::hostname {
71 $slaveof = "${redis_master_hostname} 6379"
77 if count($redis_node_ips) > 1 {
78 Class['::tripleo::redis_notification'] -> Service['redis-sentinel']
79 include ::redis::sentinel
80 class {'::tripleo::redis_notification' :
81 haproxy_monitor_ip => hiera('tripleo::loadbalancer::controller_virtual_ip'),
85 if str2bool(hiera('enable_galera', 'true')) {
86 $mysql_config_file = '/etc/my.cnf.d/galera.cnf'
88 $mysql_config_file = '/etc/my.cnf.d/server.cnf'
91 class { 'mysql::server':
92 config_file => $mysql_config_file,
95 'bind-address' => hiera('mysql_bind_host'),
96 'max_connections' => '1024',
97 'open_files_limit' => '-1',
102 # FIXME: this should only occur on the bootstrap host (ditto for db syncs)
103 # Create all the database schemas
104 # Example DSN format: mysql://user:password@host/dbname
105 $allowed_hosts = ['%',hiera('mysql_bind_host')]
106 $keystone_dsn = split(hiera('keystone::database_connection'), '[@:/?]')
107 class { 'keystone::db::mysql':
108 user => $keystone_dsn[3],
109 password => $keystone_dsn[4],
110 host => $keystone_dsn[5],
111 dbname => $keystone_dsn[6],
112 allowed_hosts => $allowed_hosts,
114 $glance_dsn = split(hiera('glance::api::database_connection'), '[@:/?]')
115 class { 'glance::db::mysql':
116 user => $glance_dsn[3],
117 password => $glance_dsn[4],
118 host => $glance_dsn[5],
119 dbname => $glance_dsn[6],
120 allowed_hosts => $allowed_hosts,
122 $nova_dsn = split(hiera('nova::database_connection'), '[@:/?]')
123 class { 'nova::db::mysql':
124 user => $nova_dsn[3],
125 password => $nova_dsn[4],
126 host => $nova_dsn[5],
127 dbname => $nova_dsn[6],
128 allowed_hosts => $allowed_hosts,
130 $neutron_dsn = split(hiera('neutron::server::database_connection'), '[@:/?]')
131 class { 'neutron::db::mysql':
132 user => $neutron_dsn[3],
133 password => $neutron_dsn[4],
134 host => $neutron_dsn[5],
135 dbname => $neutron_dsn[6],
136 allowed_hosts => $allowed_hosts,
138 $cinder_dsn = split(hiera('cinder::database_connection'), '[@:/?]')
139 class { 'cinder::db::mysql':
140 user => $cinder_dsn[3],
141 password => $cinder_dsn[4],
142 host => $cinder_dsn[5],
143 dbname => $cinder_dsn[6],
144 allowed_hosts => $allowed_hosts,
146 $heat_dsn = split(hiera('heat::database_connection'), '[@:/?]')
147 class { 'heat::db::mysql':
148 user => $heat_dsn[3],
149 password => $heat_dsn[4],
150 host => $heat_dsn[5],
151 dbname => $heat_dsn[6],
152 allowed_hosts => $allowed_hosts,
154 if downcase(hiera('ceilometer_backend')) == 'mysql' {
155 $ceilometer_dsn = split(hiera('ceilometer_mysql_conn_string'), '[@:/?]')
156 class { 'ceilometer::db::mysql':
157 user => $ceilometer_dsn[3],
158 password => $ceilometer_dsn[4],
159 host => $ceilometer_dsn[5],
160 dbname => $ceilometer_dsn[6],
161 allowed_hosts => $allowed_hosts,
165 $rabbit_nodes = hiera('rabbit_node_ips')
166 if count($rabbit_nodes) > 1 {
167 class { '::rabbitmq':
168 config_cluster => true,
169 cluster_nodes => $rabbit_nodes,
170 tcp_keepalive => false,
171 config_kernel_variables => hiera('rabbitmq_kernel_variables'),
172 config_variables => hiera('rabbitmq_config_variables'),
173 environment_variables => hiera('rabbitmq_environment'),
175 rabbitmq_policy { 'ha-all@/':
176 pattern => '^(?!amq\.).*',
185 # pre-install swift here so we can build rings
188 $cinder_enable_rbd_backend = hiera('cinder_enable_rbd_backend', false)
189 $enable_ceph = $cinder_enable_rbd_backend
192 class { 'ceph::profile::params':
193 mon_initial_members => downcase(hiera('ceph_mon_initial_members'))
195 include ::ceph::profile::mon
198 if str2bool(hiera('enable_ceph_storage', 'false')) {
199 include ::ceph::profile::client
200 include ::ceph::profile::osd
205 if hiera('step') >= 3 {
209 #TODO: need a cleanup-keystone-tokens.sh solution here
211 'ec2/driver': value => 'keystone.contrib.ec2.backends.sql.Ec2';
213 file { [ '/etc/keystone/ssl', '/etc/keystone/ssl/certs', '/etc/keystone/ssl/private' ]:
214 ensure => 'directory',
217 require => Package['keystone'],
219 file { '/etc/keystone/ssl/certs/signing_cert.pem':
220 content => hiera('keystone_signing_certificate'),
223 notify => Service['keystone'],
224 require => File['/etc/keystone/ssl/certs'],
226 file { '/etc/keystone/ssl/private/signing_key.pem':
227 content => hiera('keystone_signing_key'),
230 notify => Service['keystone'],
231 require => File['/etc/keystone/ssl/private'],
233 file { '/etc/keystone/ssl/certs/ca.pem':
234 content => hiera('keystone_ca_certificate'),
237 notify => Service['keystone'],
238 require => File['/etc/keystone/ssl/certs'],
241 $glance_backend = downcase(hiera('glance_backend', 'swift'))
242 case $glance_backend {
243 swift: { $glance_store = 'glance.store.swift.Store' }
244 file: { $glance_store = 'glance.store.filesystem.Store' }
245 rbd: { $glance_store = 'glance.store.rbd.Store' }
246 default: { fail('Unrecognized glance_backend parameter.') }
249 # TODO: notifications, scrubber, etc.
251 class { 'glance::api':
252 known_stores => [$glance_store]
254 include ::glance::registry
255 include join(['::glance::backend::', $glance_backend])
258 glance_api_servers => join([hiera('glance_protocol'), '://', hiera('controller_virtual_ip'), ':', hiera('glance_port')]),
263 include ::nova::conductor
264 include ::nova::consoleauth
265 include ::nova::network::neutron
266 include ::nova::vncproxy
267 include ::nova::scheduler
270 include ::neutron::server
271 include ::neutron::agents::l3
272 include ::neutron::agents::dhcp
273 class { 'neutron::agents::metadata':
274 auth_url => join(['http://', hiera('controller_virtual_ip'), ':35357/v2.0']),
277 file { '/etc/neutron/dnsmasq-neutron.conf':
278 content => hiera('neutron_dnsmasq_options'),
281 notify => Service['neutron-dhcp-service'],
282 require => Package['neutron'],
285 class { 'neutron::plugins::ml2':
286 flat_networks => split(hiera('neutron_flat_networks'), ','),
287 tenant_network_types => [hiera('neutron_tenant_network_type')],
288 type_drivers => [hiera('neutron_tenant_network_type')],
290 class { 'neutron::agents::ml2::ovs':
291 bridge_mappings => split(hiera('neutron_bridge_mappings'), ','),
292 tunnel_types => split(hiera('neutron_tunnel_types'), ','),
295 Service['neutron-server'] -> Service['neutron-dhcp-service']
296 Service['neutron-server'] -> Service['neutron-l3']
297 Service['neutron-server'] -> Service['neutron-ovs-agent-service']
298 Service['neutron-server'] -> Service['neutron-metadata']
301 include ::cinder::api
302 include ::cinder::glance
303 include ::cinder::scheduler
304 include ::cinder::volume
305 class {'cinder::setup_test_volume':
306 size => join([hiera('cinder_lvm_loop_device_size'), 'M']),
309 $cinder_enable_iscsi = hiera('cinder_enable_iscsi_backend', true)
310 if $cinder_enable_iscsi {
311 $cinder_iscsi_backend = 'tripleo_iscsi'
313 cinder::backend::iscsi { $cinder_iscsi_backend :
314 iscsi_ip_address => hiera('cinder_iscsi_ip_address'),
315 iscsi_helper => hiera('cinder_iscsi_helper'),
322 pg_num => hiera('ceph::profile::params::osd_pool_default_pg_num'),
323 pgp_num => hiera('ceph::profile::params::osd_pool_default_pgp_num'),
324 size => hiera('ceph::profile::params::osd_pool_default_size'),
327 $ceph_pools = hiera('ceph_pools')
328 ceph::pool { $ceph_pools : }
331 if $cinder_enable_rbd_backend {
332 $cinder_rbd_backend = 'tripleo_ceph'
335 "${cinder_rbd_backend}/host": value => 'hostgroup';
338 cinder::backend::rbd { $cinder_rbd_backend :
339 rbd_pool => 'volumes',
340 rbd_user => 'openstack',
341 rbd_secret_uuid => hiera('ceph::profile::params::fsid'),
342 require => Ceph::Pool['volumes'],
346 $cinder_enabled_backends = delete_undef_values([$cinder_iscsi_backend, $cinder_rbd_backend])
347 class { '::cinder::backends' :
348 enabled_backends => $cinder_enabled_backends,
353 include ::swift::proxy
354 include ::swift::proxy::proxy_logging
355 include ::swift::proxy::healthcheck
356 include ::swift::proxy::cache
357 include ::swift::proxy::keystone
358 include ::swift::proxy::authtoken
359 include ::swift::proxy::staticweb
360 include ::swift::proxy::ceilometer
361 include ::swift::proxy::ratelimit
362 include ::swift::proxy::catch_errors
363 include ::swift::proxy::tempurl
364 include ::swift::proxy::formpost
367 if str2bool(hiera('enable_swift_storage', 'true')) {
368 class {'swift::storage::all':
369 mount_check => str2bool(hiera('swift_mount_check'))
371 if(!defined(File['/srv/node'])) {
376 require => Package['openstack-swift'],
379 $swift_components = ['account', 'container', 'object']
380 swift::storage::filter::recon { $swift_components : }
381 swift::storage::filter::healthcheck { $swift_components : }
385 $ceilometer_backend = downcase(hiera('ceilometer_backend'))
386 case $ceilometer_backend {
388 $ceilometer_database_connection = hiera('ceilometer_mysql_conn_string')
391 $ceilometer_database_connection = $ceilometer_mongodb_conn_string
395 include ::ceilometer::api
396 include ::ceilometer::agent::notification
397 include ::ceilometer::agent::central
398 include ::ceilometer::alarm::notifier
399 include ::ceilometer::alarm::evaluator
400 include ::ceilometer::expirer
401 include ::ceilometer::collector
402 class { '::ceilometer::db' :
403 database_connection => $ceilometer_database_connection,
405 class { 'ceilometer::agent::auth':
406 auth_url => join(['http://', hiera('controller_virtual_ip'), ':5000/v2.0']),
409 Cron <| title == 'ceilometer-expirer' |> { command => "sleep $((\$(od -A n -t d -N 3 /dev/urandom) % 86400)) && ${::ceilometer::params::expirer_command}" }
414 include ::heat::api_cfn
415 include ::heat::api_cloudwatch
416 include ::heat::engine
419 $vhost_params = { add_listen => false }
421 cache_server_ip => split(hiera('memcache_node_ips', '127.0.0.1'), ','),
422 vhost_extra_params => $vhost_params,
425 $snmpd_user = hiera('snmpd_readonly_user_name')
426 snmp::snmpv3_user { $snmpd_user:
428 authpass => hiera('snmpd_readonly_user_password'),
431 agentaddress => ['udp:161','udp6:[::1]:161'],
432 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' ],