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 include ::tripleo::redis_notification
82 if str2bool(hiera('enable_galera', 'true')) {
83 $mysql_config_file = '/etc/my.cnf.d/galera.cnf'
85 $mysql_config_file = '/etc/my.cnf.d/server.cnf'
88 class { 'mysql::server':
89 config_file => $mysql_config_file,
92 'bind-address' => hiera('mysql_bind_host'),
93 'max_connections' => '1024',
94 'open_files_limit' => '-1',
99 # FIXME: this should only occur on the bootstrap host (ditto for db syncs)
100 # Create all the database schemas
101 # Example DSN format: mysql://user:password@host/dbname
102 $allowed_hosts = ['%',hiera('mysql_bind_host')]
103 $keystone_dsn = split(hiera('keystone::database_connection'), '[@:/?]')
104 class { 'keystone::db::mysql':
105 user => $keystone_dsn[3],
106 password => $keystone_dsn[4],
107 host => $keystone_dsn[5],
108 dbname => $keystone_dsn[6],
109 allowed_hosts => $allowed_hosts,
111 $glance_dsn = split(hiera('glance::api::database_connection'), '[@:/?]')
112 class { 'glance::db::mysql':
113 user => $glance_dsn[3],
114 password => $glance_dsn[4],
115 host => $glance_dsn[5],
116 dbname => $glance_dsn[6],
117 allowed_hosts => $allowed_hosts,
119 $nova_dsn = split(hiera('nova::database_connection'), '[@:/?]')
120 class { 'nova::db::mysql':
121 user => $nova_dsn[3],
122 password => $nova_dsn[4],
123 host => $nova_dsn[5],
124 dbname => $nova_dsn[6],
125 allowed_hosts => $allowed_hosts,
127 $neutron_dsn = split(hiera('neutron::server::database_connection'), '[@:/?]')
128 class { 'neutron::db::mysql':
129 user => $neutron_dsn[3],
130 password => $neutron_dsn[4],
131 host => $neutron_dsn[5],
132 dbname => $neutron_dsn[6],
133 allowed_hosts => $allowed_hosts,
135 $cinder_dsn = split(hiera('cinder::database_connection'), '[@:/?]')
136 class { 'cinder::db::mysql':
137 user => $cinder_dsn[3],
138 password => $cinder_dsn[4],
139 host => $cinder_dsn[5],
140 dbname => $cinder_dsn[6],
141 allowed_hosts => $allowed_hosts,
143 $heat_dsn = split(hiera('heat::database_connection'), '[@:/?]')
144 class { 'heat::db::mysql':
145 user => $heat_dsn[3],
146 password => $heat_dsn[4],
147 host => $heat_dsn[5],
148 dbname => $heat_dsn[6],
149 allowed_hosts => $allowed_hosts,
151 if downcase(hiera('ceilometer_backend')) == 'mysql' {
152 $ceilometer_dsn = split(hiera('ceilometer_mysql_conn_string'), '[@:/?]')
153 class { 'ceilometer::db::mysql':
154 user => $ceilometer_dsn[3],
155 password => $ceilometer_dsn[4],
156 host => $ceilometer_dsn[5],
157 dbname => $ceilometer_dsn[6],
158 allowed_hosts => $allowed_hosts,
162 $rabbit_nodes = hiera('rabbit_node_ips')
163 if count($rabbit_nodes) > 1 {
164 class { '::rabbitmq':
165 config_cluster => true,
166 cluster_nodes => $rabbit_nodes,
167 tcp_keepalive => false,
168 config_kernel_variables => hiera('rabbitmq_kernel_variables'),
169 config_variables => hiera('rabbitmq_config_variables'),
170 environment_variables => hiera('rabbitmq_environment'),
172 rabbitmq_policy { 'ha-all@/':
173 pattern => '^(?!amq\.).*',
182 # pre-install swift here so we can build rings
185 $cinder_enable_rbd_backend = hiera('cinder_enable_rbd_backend', false)
186 $enable_ceph = $cinder_enable_rbd_backend
189 class { 'ceph::profile::params':
190 mon_initial_members => downcase(hiera('ceph_mon_initial_members'))
192 include ::ceph::profile::mon
195 if str2bool(hiera('enable_ceph_storage', 'false')) {
196 include ::ceph::profile::client
197 include ::ceph::profile::osd
202 if hiera('step') >= 3 {
206 #TODO: need a cleanup-keystone-tokens.sh solution here
208 'ec2/driver': value => 'keystone.contrib.ec2.backends.sql.Ec2';
210 file { [ '/etc/keystone/ssl', '/etc/keystone/ssl/certs', '/etc/keystone/ssl/private' ]:
211 ensure => 'directory',
214 require => Package['keystone'],
216 file { '/etc/keystone/ssl/certs/signing_cert.pem':
217 content => hiera('keystone_signing_certificate'),
220 notify => Service['keystone'],
221 require => File['/etc/keystone/ssl/certs'],
223 file { '/etc/keystone/ssl/private/signing_key.pem':
224 content => hiera('keystone_signing_key'),
227 notify => Service['keystone'],
228 require => File['/etc/keystone/ssl/private'],
230 file { '/etc/keystone/ssl/certs/ca.pem':
231 content => hiera('keystone_ca_certificate'),
234 notify => Service['keystone'],
235 require => File['/etc/keystone/ssl/certs'],
238 $glance_backend = downcase(hiera('glance_backend', 'swift'))
239 case $glance_backend {
240 swift: { $glance_store = 'glance.store.swift.Store' }
241 file: { $glance_store = 'glance.store.filesystem.Store' }
242 rbd: { $glance_store = 'glance.store.rbd.Store' }
243 default: { fail('Unrecognized glance_backend parameter.') }
246 # TODO: notifications, scrubber, etc.
248 class { 'glance::api':
249 known_stores => [$glance_store]
251 include ::glance::registry
252 include join(['::glance::backend::', $glance_backend])
257 include ::nova::conductor
258 include ::nova::consoleauth
259 include ::nova::network::neutron
260 include ::nova::vncproxy
261 include ::nova::scheduler
264 include ::neutron::server
265 include ::neutron::agents::l3
266 include ::neutron::agents::dhcp
267 include ::neutron::agents::metadata
269 file { '/etc/neutron/dnsmasq-neutron.conf':
270 content => hiera('neutron_dnsmasq_options'),
273 notify => Service['neutron-dhcp-service'],
274 require => Package['neutron'],
277 class { 'neutron::plugins::ml2':
278 flat_networks => split(hiera('neutron_flat_networks'), ','),
279 tenant_network_types => [hiera('neutron_tenant_network_type')],
281 class { 'neutron::agents::ml2::ovs':
282 bridge_mappings => split(hiera('neutron_bridge_mappings'), ','),
283 tunnel_types => split(hiera('neutron_tunnel_types'), ','),
286 Service['neutron-server'] -> Service['neutron-dhcp-service']
287 Service['neutron-server'] -> Service['neutron-l3']
288 Service['neutron-server'] -> Service['neutron-ovs-agent-service']
289 Service['neutron-server'] -> Service['neutron-metadata']
292 include ::cinder::api
293 include ::cinder::glance
294 include ::cinder::scheduler
295 include ::cinder::volume
296 class {'cinder::setup_test_volume':
297 size => join([hiera('cinder_lvm_loop_device_size'), 'M']),
300 $cinder_enable_iscsi = hiera('cinder_enable_iscsi_backend', true)
301 if $cinder_enable_iscsi {
302 $cinder_iscsi_backend = 'tripleo_iscsi'
304 cinder::backend::iscsi { $cinder_iscsi_backend :
305 iscsi_ip_address => hiera('cinder_iscsi_ip_address'),
306 iscsi_helper => hiera('cinder_iscsi_helper'),
313 pg_num => hiera('ceph::profile::params::osd_pool_default_pg_num'),
314 pgp_num => hiera('ceph::profile::params::osd_pool_default_pgp_num'),
315 size => hiera('ceph::profile::params::osd_pool_default_size'),
318 $ceph_pools = hiera('ceph_pools')
319 ceph::pool { $ceph_pools : }
322 if $cinder_enable_rbd_backend {
323 $cinder_rbd_backend = 'tripleo_ceph'
326 "${cinder_rbd_backend}/host": value => 'hostgroup';
329 cinder::backend::rbd { $cinder_rbd_backend :
330 rbd_pool => 'volumes',
331 rbd_user => 'openstack',
332 rbd_secret_uuid => hiera('ceph::profile::params::fsid'),
333 require => Ceph::Pool['volumes'],
337 if hiera('cinder_enable_netapp_backend', false) {
338 $cinder_netapp_backend = hiera('cinder::backend::netapp::title')
341 "${cinder_netapp_backend}/host": value => 'hostgroup';
344 if hiera('cinder_netapp_nfs_shares', undef) {
345 $cinder_netapp_nfs_shares = split(hiera('cinder_netapp_nfs_shares', undef), ',')
348 cinder::backend::netapp { $cinder_netapp_backend :
349 nfs_shares => $cinder_netapp_nfs_shares,
353 $cinder_enabled_backends = delete_undef_values([$cinder_iscsi_backend, $cinder_rbd_backend, $cinder_netapp_backend])
354 class { '::cinder::backends' :
355 enabled_backends => $cinder_enabled_backends,
360 include ::swift::proxy
361 include ::swift::proxy::proxy_logging
362 include ::swift::proxy::healthcheck
363 include ::swift::proxy::cache
364 include ::swift::proxy::keystone
365 include ::swift::proxy::authtoken
366 include ::swift::proxy::staticweb
367 include ::swift::proxy::ratelimit
368 include ::swift::proxy::catch_errors
369 include ::swift::proxy::tempurl
370 include ::swift::proxy::formpost
373 if str2bool(hiera('enable_swift_storage', 'true')) {
374 class {'swift::storage::all':
375 mount_check => str2bool(hiera('swift_mount_check'))
377 if(!defined(File['/srv/node'])) {
382 require => Package['openstack-swift'],
385 $swift_components = ['account', 'container', 'object']
386 swift::storage::filter::recon { $swift_components : }
387 swift::storage::filter::healthcheck { $swift_components : }
391 $ceilometer_backend = downcase(hiera('ceilometer_backend'))
392 case $ceilometer_backend {
394 $ceilometer_database_connection = hiera('ceilometer_mysql_conn_string')
397 $ceilometer_database_connection = $ceilometer_mongodb_conn_string
401 include ::ceilometer::api
402 include ::ceilometer::agent::notification
403 include ::ceilometer::agent::central
404 include ::ceilometer::alarm::notifier
405 include ::ceilometer::alarm::evaluator
406 include ::ceilometer::expirer
407 include ::ceilometer::collector
408 include ceilometer::agent::auth
409 class { '::ceilometer::db' :
410 database_connection => $ceilometer_database_connection,
413 Cron <| title == 'ceilometer-expirer' |> { command => "sleep $((\$(od -A n -t d -N 3 /dev/urandom) % 86400)) && ${::ceilometer::params::expirer_command}" }
418 include ::heat::api_cfn
419 include ::heat::api_cloudwatch
420 include ::heat::engine
423 $vhost_params = { add_listen => false }
425 cache_server_ip => hiera('memcache_node_ips', '127.0.0.1'),
426 vhost_extra_params => $vhost_params,
429 $snmpd_user = hiera('snmpd_readonly_user_name')
430 snmp::snmpv3_user { $snmpd_user:
432 authpass => hiera('snmpd_readonly_user_password'),
435 agentaddress => ['udp:161','udp6:[::1]:161'],
436 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' ],