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' => hiera('mysql_max_connections'),
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: { $backend_store = 'glance.store.swift.Store' }
241 file: { $backend_store = 'glance.store.filesystem.Store' }
242 rbd: { $backend_store = 'glance.store.rbd.Store' }
243 default: { fail('Unrecognized glance_backend parameter.') }
245 $http_store = ['glance.store.http.Store']
246 $glance_store = concat($http_store, $backend_store)
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])
259 include ::nova::conductor
260 include ::nova::consoleauth
261 include ::nova::network::neutron
262 include ::nova::vncproxy
263 include ::nova::scheduler
266 include ::neutron::server
267 include ::neutron::agents::l3
268 include ::neutron::agents::dhcp
269 include ::neutron::agents::metadata
271 file { '/etc/neutron/dnsmasq-neutron.conf':
272 content => hiera('neutron_dnsmasq_options'),
275 notify => Service['neutron-dhcp-service'],
276 require => Package['neutron'],
279 class { 'neutron::plugins::ml2':
280 flat_networks => split(hiera('neutron_flat_networks'), ','),
281 tenant_network_types => [hiera('neutron_tenant_network_type')],
283 class { 'neutron::agents::ml2::ovs':
284 bridge_mappings => split(hiera('neutron_bridge_mappings'), ','),
285 tunnel_types => split(hiera('neutron_tunnel_types'), ','),
288 Service['neutron-server'] -> Service['neutron-dhcp-service']
289 Service['neutron-server'] -> Service['neutron-l3']
290 Service['neutron-server'] -> Service['neutron-ovs-agent-service']
291 Service['neutron-server'] -> Service['neutron-metadata']
294 include ::cinder::api
295 include ::cinder::glance
296 include ::cinder::scheduler
297 include ::cinder::volume
298 class {'cinder::setup_test_volume':
299 size => join([hiera('cinder_lvm_loop_device_size'), 'M']),
302 $cinder_enable_iscsi = hiera('cinder_enable_iscsi_backend', true)
303 if $cinder_enable_iscsi {
304 $cinder_iscsi_backend = 'tripleo_iscsi'
306 cinder::backend::iscsi { $cinder_iscsi_backend :
307 iscsi_ip_address => hiera('cinder_iscsi_ip_address'),
308 iscsi_helper => hiera('cinder_iscsi_helper'),
315 pg_num => hiera('ceph::profile::params::osd_pool_default_pg_num'),
316 pgp_num => hiera('ceph::profile::params::osd_pool_default_pgp_num'),
317 size => hiera('ceph::profile::params::osd_pool_default_size'),
320 $ceph_pools = hiera('ceph_pools')
321 ceph::pool { $ceph_pools : }
324 if $cinder_enable_rbd_backend {
325 $cinder_rbd_backend = 'tripleo_ceph'
328 "${cinder_rbd_backend}/host": value => 'hostgroup';
331 cinder::backend::rbd { $cinder_rbd_backend :
332 rbd_pool => 'volumes',
333 rbd_user => 'openstack',
334 rbd_secret_uuid => hiera('ceph::profile::params::fsid'),
335 require => Ceph::Pool['volumes'],
339 if hiera('cinder_enable_netapp_backend', false) {
340 $cinder_netapp_backend = hiera('cinder::backend::netapp::title')
343 "${cinder_netapp_backend}/host": value => 'hostgroup';
346 if hiera('cinder_netapp_nfs_shares', undef) {
347 $cinder_netapp_nfs_shares = split(hiera('cinder_netapp_nfs_shares', undef), ',')
350 cinder::backend::netapp { $cinder_netapp_backend :
351 nfs_shares => $cinder_netapp_nfs_shares,
355 $cinder_enabled_backends = delete_undef_values([$cinder_iscsi_backend, $cinder_rbd_backend, $cinder_netapp_backend])
356 class { '::cinder::backends' :
357 enabled_backends => $cinder_enabled_backends,
362 include ::swift::proxy
363 include ::swift::proxy::proxy_logging
364 include ::swift::proxy::healthcheck
365 include ::swift::proxy::cache
366 include ::swift::proxy::keystone
367 include ::swift::proxy::authtoken
368 include ::swift::proxy::staticweb
369 include ::swift::proxy::ratelimit
370 include ::swift::proxy::catch_errors
371 include ::swift::proxy::tempurl
372 include ::swift::proxy::formpost
375 if str2bool(hiera('enable_swift_storage', 'true')) {
376 class {'swift::storage::all':
377 mount_check => str2bool(hiera('swift_mount_check'))
379 if(!defined(File['/srv/node'])) {
384 require => Package['openstack-swift'],
387 $swift_components = ['account', 'container', 'object']
388 swift::storage::filter::recon { $swift_components : }
389 swift::storage::filter::healthcheck { $swift_components : }
393 $ceilometer_backend = downcase(hiera('ceilometer_backend'))
394 case $ceilometer_backend {
396 $ceilometer_database_connection = hiera('ceilometer_mysql_conn_string')
399 $ceilometer_database_connection = $ceilometer_mongodb_conn_string
403 include ::ceilometer::api
404 include ::ceilometer::agent::notification
405 include ::ceilometer::agent::central
406 include ::ceilometer::alarm::notifier
407 include ::ceilometer::alarm::evaluator
408 include ::ceilometer::expirer
409 include ::ceilometer::collector
410 include ceilometer::agent::auth
411 class { '::ceilometer::db' :
412 database_connection => $ceilometer_database_connection,
415 Cron <| title == 'ceilometer-expirer' |> { command => "sleep $((\$(od -A n -t d -N 3 /dev/urandom) % 86400)) && ${::ceilometer::params::expirer_command}" }
420 include ::heat::api_cfn
421 include ::heat::api_cloudwatch
422 include ::heat::engine
425 $vhost_params = { add_listen => false }
427 cache_server_ip => hiera('memcache_node_ips', '127.0.0.1'),
428 vhost_extra_params => $vhost_params,
431 $snmpd_user = hiera('snmpd_readonly_user_name')
432 snmp::snmpv3_user { $snmpd_user:
434 authpass => hiera('snmpd_readonly_user_password'),
437 agentaddress => ['udp:161','udp6:[::1]:161'],
438 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' ],
441 hiera_include('controller_classes')