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 include ::ceph::profile::client
188 include ::ceph::profile::osd
193 if hiera('step') >= 3 {
197 #TODO: need a cleanup-keystone-tokens.sh solution here
199 'ec2/driver': value => 'keystone.contrib.ec2.backends.sql.Ec2';
201 file { [ '/etc/keystone/ssl', '/etc/keystone/ssl/certs', '/etc/keystone/ssl/private' ]:
202 ensure => 'directory',
205 require => Package['keystone'],
207 file { '/etc/keystone/ssl/certs/signing_cert.pem':
208 content => hiera('keystone_signing_certificate'),
211 notify => Service['keystone'],
212 require => File['/etc/keystone/ssl/certs'],
214 file { '/etc/keystone/ssl/private/signing_key.pem':
215 content => hiera('keystone_signing_key'),
218 notify => Service['keystone'],
219 require => File['/etc/keystone/ssl/private'],
221 file { '/etc/keystone/ssl/certs/ca.pem':
222 content => hiera('keystone_ca_certificate'),
225 notify => Service['keystone'],
226 require => File['/etc/keystone/ssl/certs'],
229 $glance_backend = downcase(hiera('glance_backend', 'swift'))
230 case $glance_backend {
231 swift: { $backend_store = 'glance.store.swift.Store' }
232 file: { $backend_store = 'glance.store.filesystem.Store' }
233 rbd: { $backend_store = 'glance.store.rbd.Store' }
234 default: { fail('Unrecognized glance_backend parameter.') }
236 $http_store = ['glance.store.http.Store']
237 $glance_store = concat($http_store, $backend_store)
239 # TODO: notifications, scrubber, etc.
241 class { 'glance::api':
242 known_stores => $glance_store
244 include ::glance::registry
245 include join(['::glance::backend::', $glance_backend])
250 include ::nova::conductor
251 include ::nova::consoleauth
252 include ::nova::network::neutron
253 include ::nova::vncproxy
254 include ::nova::scheduler
257 include ::neutron::server
258 include ::neutron::agents::l3
259 include ::neutron::agents::dhcp
260 include ::neutron::agents::metadata
262 file { '/etc/neutron/dnsmasq-neutron.conf':
263 content => hiera('neutron_dnsmasq_options'),
266 notify => Service['neutron-dhcp-service'],
267 require => Package['neutron'],
270 class { 'neutron::plugins::ml2':
271 flat_networks => split(hiera('neutron_flat_networks'), ','),
272 tenant_network_types => [hiera('neutron_tenant_network_type')],
274 class { 'neutron::agents::ml2::ovs':
275 bridge_mappings => split(hiera('neutron_bridge_mappings'), ','),
276 tunnel_types => split(hiera('neutron_tunnel_types'), ','),
279 Service['neutron-server'] -> Service['neutron-dhcp-service']
280 Service['neutron-server'] -> Service['neutron-l3']
281 Service['neutron-server'] -> Service['neutron-ovs-agent-service']
282 Service['neutron-server'] -> Service['neutron-metadata']
285 include ::cinder::api
286 include ::cinder::glance
287 include ::cinder::scheduler
288 include ::cinder::volume
289 class {'cinder::setup_test_volume':
290 size => join([hiera('cinder_lvm_loop_device_size'), 'M']),
293 $cinder_enable_iscsi = hiera('cinder_enable_iscsi_backend', true)
294 if $cinder_enable_iscsi {
295 $cinder_iscsi_backend = 'tripleo_iscsi'
297 cinder::backend::iscsi { $cinder_iscsi_backend :
298 iscsi_ip_address => hiera('cinder_iscsi_ip_address'),
299 iscsi_helper => hiera('cinder_iscsi_helper'),
306 pg_num => hiera('ceph::profile::params::osd_pool_default_pg_num'),
307 pgp_num => hiera('ceph::profile::params::osd_pool_default_pgp_num'),
308 size => hiera('ceph::profile::params::osd_pool_default_size'),
311 $ceph_pools = hiera('ceph_pools')
312 ceph::pool { $ceph_pools : }
315 if $cinder_enable_rbd_backend {
316 $cinder_rbd_backend = 'tripleo_ceph'
319 "${cinder_rbd_backend}/host": value => 'hostgroup';
322 cinder::backend::rbd { $cinder_rbd_backend :
323 rbd_pool => 'volumes',
324 rbd_user => 'openstack',
325 rbd_secret_uuid => hiera('ceph::profile::params::fsid'),
326 require => Ceph::Pool['volumes'],
330 if hiera('cinder_enable_netapp_backend', false) {
331 $cinder_netapp_backend = hiera('cinder::backend::netapp::title')
334 "${cinder_netapp_backend}/host": value => 'hostgroup';
337 if hiera('cinder::backend::netapp::nfs_shares', undef) {
338 $cinder_netapp_nfs_shares = split(hiera('cinder::backend::netapp::nfs_shares', undef), ',')
341 cinder::backend::netapp { $cinder_netapp_backend :
342 netapp_login => hiera('cinder::backend::netapp::netapp_login', undef),
343 netapp_password => hiera('cinder::backend::netapp::netapp_password', undef),
344 netapp_server_hostname => hiera('cinder::backend::netapp::netapp_server_hostname', undef),
345 netapp_server_port => hiera('cinder::backend::netapp::netapp_server_port', undef),
346 netapp_size_multiplier => hiera('cinder::backend::netapp::netapp_size_multiplier', undef),
347 netapp_storage_family => hiera('cinder::backend::netapp::netapp_storage_family', undef),
348 netapp_storage_protocol => hiera('cinder::backend::netapp::netapp_storage_protocol', undef),
349 netapp_transport_type => hiera('cinder::backend::netapp::netapp_transport_type', undef),
350 netapp_vfiler => hiera('cinder::backend::netapp::netapp_vfiler', undef),
351 netapp_volume_list => hiera('cinder::backend::netapp::netapp_volume_list', undef),
352 netapp_vserver => hiera('cinder::backend::netapp::netapp_vserver', undef),
353 netapp_partner_backend_name => hiera('cinder::backend::netapp::netapp_partner_backend_name', undef),
354 nfs_shares => $cinder_netapp_nfs_shares,
355 nfs_shares_config => hiera('cinder::backend::netapp::nfs_shares_config', undef),
356 netapp_copyoffload_tool_path => hiera('cinder::backend::netapp::netapp_copyoffload_tool_path', undef),
357 netapp_controller_ips => hiera('cinder::backend::netapp::netapp_controller_ips', undef),
358 netapp_sa_password => hiera('cinder::backend::netapp::netapp_sa_password', undef),
359 netapp_storage_pools => hiera('cinder::backend::netapp::netapp_storage_pools', undef),
360 netapp_eseries_host_type => hiera('cinder::backend::netapp::netapp_eseries_host_type', undef),
361 netapp_webservice_path => hiera('cinder::backend::netapp::netapp_webservice_path', undef),
365 $cinder_enabled_backends = delete_undef_values([$cinder_iscsi_backend, $cinder_rbd_backend, $cinder_netapp_backend])
366 class { '::cinder::backends' :
367 enabled_backends => $cinder_enabled_backends,
372 include ::swift::proxy
373 include ::swift::proxy::proxy_logging
374 include ::swift::proxy::healthcheck
375 include ::swift::proxy::cache
376 include ::swift::proxy::keystone
377 include ::swift::proxy::authtoken
378 include ::swift::proxy::staticweb
379 include ::swift::proxy::ratelimit
380 include ::swift::proxy::catch_errors
381 include ::swift::proxy::tempurl
382 include ::swift::proxy::formpost
385 if str2bool(hiera('enable_swift_storage', 'true')) {
386 class {'swift::storage::all':
387 mount_check => str2bool(hiera('swift_mount_check'))
389 if(!defined(File['/srv/node'])) {
394 require => Package['openstack-swift'],
397 $swift_components = ['account', 'container', 'object']
398 swift::storage::filter::recon { $swift_components : }
399 swift::storage::filter::healthcheck { $swift_components : }
403 $ceilometer_backend = downcase(hiera('ceilometer_backend'))
404 case $ceilometer_backend {
406 $ceilometer_database_connection = hiera('ceilometer_mysql_conn_string')
409 $ceilometer_database_connection = $ceilometer_mongodb_conn_string
413 include ::ceilometer::api
414 include ::ceilometer::agent::notification
415 include ::ceilometer::agent::central
416 include ::ceilometer::alarm::notifier
417 include ::ceilometer::alarm::evaluator
418 include ::ceilometer::expirer
419 include ::ceilometer::collector
420 include ceilometer::agent::auth
421 class { '::ceilometer::db' :
422 database_connection => $ceilometer_database_connection,
425 Cron <| title == 'ceilometer-expirer' |> { command => "sleep $((\$(od -A n -t d -N 3 /dev/urandom) % 86400)) && ${::ceilometer::params::expirer_command}" }
430 include ::heat::api_cfn
431 include ::heat::api_cloudwatch
432 include ::heat::engine
435 $vhost_params = { add_listen => false }
437 cache_server_ip => hiera('memcache_node_ips', '127.0.0.1'),
438 vhost_extra_params => $vhost_params,
441 $snmpd_user = hiera('snmpd_readonly_user_name')
442 snmp::snmpv3_user { $snmpd_user:
444 authpass => hiera('snmpd_readonly_user_password'),
447 agentaddress => ['udp:161','udp6:[::1]:161'],
448 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' ],
451 hiera_include('controller_classes')