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 $controller_node_ips = split(hiera('controller_node_ips'), ',')
30 $enable_pacemaker = str2bool(hiera('enable_pacemaker'))
31 $enable_keepalived = !$enable_pacemaker
33 class { '::tripleo::loadbalancer' :
34 controller_hosts => $controller_node_ips,
35 manage_vip => $enable_keepalived,
38 if $enable_pacemaker {
39 $pacemaker_cluster_members = regsubst(hiera('controller_node_ips'), ',', ' ', 'G')
40 if $::hostname == downcase(hiera('bootstrap_nodeid')) {
41 $pacemaker_master = true
43 $pacemaker_master = false
48 class { '::pacemaker':
49 hacluster_pwd => hiera('hacluster_pwd'),
51 class { '::pacemaker::corosync':
52 cluster_members => $pacemaker_cluster_members,
53 setup_cluster => $pacemaker_master,
55 class { '::pacemaker::stonith':
58 if $pacemaker_master {
59 $control_vip = hiera('tripleo::loadbalancer::controller_virtual_ip')
60 pacemaker::resource::ip { 'control_vip':
61 ip_address => $control_vip,
63 $public_vip = hiera('tripleo::loadbalancer::public_virtual_ip')
64 pacemaker::resource::ip { 'public_vip':
65 ip_address => $public_vip,
72 if hiera('step') >= 2 {
74 if count(hiera('ntp::servers')) > 0 {
79 include ::mongodb::globals
80 include ::mongodb::server
81 $mongo_node_ips = split(hiera('mongo_node_ips'), ',')
82 $mongo_node_ips_with_port = suffix($mongo_node_ips, ':27017')
83 $mongo_node_string = join($mongo_node_ips_with_port, ',')
85 $mongodb_replset = hiera('mongodb::server::replset')
86 $ceilometer_mongodb_conn_string = "mongodb://${mongo_node_string}/ceilometer?replicaSet=${mongodb_replset}"
87 if downcase(hiera('bootstrap_nodeid')) == $::hostname {
88 mongodb_replset { $mongodb_replset :
89 members => $mongo_node_ips_with_port,
94 $redis_node_ips = split(hiera('redis_node_ips'), ',')
95 $redis_master_hostname = downcase(hiera('bootstrap_nodeid'))
97 if $redis_master_hostname == $::hostname {
100 $slaveof = "${redis_master_hostname} 6379"
106 if count($redis_node_ips) > 1 {
107 Class['::tripleo::redis_notification'] -> Service['redis-sentinel']
108 include ::redis::sentinel
109 class {'::tripleo::redis_notification' :
110 haproxy_monitor_ip => hiera('tripleo::loadbalancer::controller_virtual_ip'),
114 if str2bool(hiera('enable_galera', 'true')) {
115 $mysql_config_file = '/etc/my.cnf.d/galera.cnf'
117 $mysql_config_file = '/etc/my.cnf.d/server.cnf'
120 class { 'mysql::server':
121 config_file => $mysql_config_file,
122 override_options => {
124 'bind-address' => hiera('controller_host')
129 # FIXME: this should only occur on the bootstrap host (ditto for db syncs)
130 # Create all the database schemas
131 # Example DSN format: mysql://user:password@host/dbname
132 $allowed_hosts = ['%',hiera('controller_host')]
133 $keystone_dsn = split(hiera('keystone::database_connection'), '[@:/?]')
134 class { 'keystone::db::mysql':
135 user => $keystone_dsn[3],
136 password => $keystone_dsn[4],
137 host => $keystone_dsn[5],
138 dbname => $keystone_dsn[6],
139 allowed_hosts => $allowed_hosts,
141 $glance_dsn = split(hiera('glance::api::database_connection'), '[@:/?]')
142 class { 'glance::db::mysql':
143 user => $glance_dsn[3],
144 password => $glance_dsn[4],
145 host => $glance_dsn[5],
146 dbname => $glance_dsn[6],
147 allowed_hosts => $allowed_hosts,
149 $nova_dsn = split(hiera('nova::database_connection'), '[@:/?]')
150 class { 'nova::db::mysql':
151 user => $nova_dsn[3],
152 password => $nova_dsn[4],
153 host => $nova_dsn[5],
154 dbname => $nova_dsn[6],
155 allowed_hosts => $allowed_hosts,
157 $neutron_dsn = split(hiera('neutron::server::database_connection'), '[@:/?]')
158 class { 'neutron::db::mysql':
159 user => $neutron_dsn[3],
160 password => $neutron_dsn[4],
161 host => $neutron_dsn[5],
162 dbname => $neutron_dsn[6],
163 allowed_hosts => $allowed_hosts,
165 $cinder_dsn = split(hiera('cinder::database_connection'), '[@:/?]')
166 class { 'cinder::db::mysql':
167 user => $cinder_dsn[3],
168 password => $cinder_dsn[4],
169 host => $cinder_dsn[5],
170 dbname => $cinder_dsn[6],
171 allowed_hosts => $allowed_hosts,
173 $heat_dsn = split(hiera('heat::database_connection'), '[@:/?]')
174 class { 'heat::db::mysql':
175 user => $heat_dsn[3],
176 password => $heat_dsn[4],
177 host => $heat_dsn[5],
178 dbname => $heat_dsn[6],
179 allowed_hosts => $allowed_hosts,
182 $rabbit_nodes = split(downcase(hiera('rabbit_node_names', $::hostname)), ',')
183 if count($rabbit_nodes) > 1 {
184 $rabbit_cluster = true
187 $rabbit_cluster = false
190 config_cluster => $rabbit_cluster,
191 cluster_nodes => $rabbit_nodes,
192 node_ip_address => hiera('controller_host'),
195 rabbitmq_policy { 'ha-all@/':
196 pattern => '^(?!amq\.).*',
199 'ha-sync-mode' => 'automatic',
203 rabbitmq_vhost { '/':
204 provider => 'rabbitmqctl',
207 # pre-install swift here so we can build rings
210 $cinder_enable_rbd_backend = hiera('cinder_enable_rbd_backend', false)
211 $enable_ceph = $cinder_enable_rbd_backend
214 class { 'ceph::profile::params':
215 mon_initial_members => downcase(hiera('ceph_mon_initial_members'))
217 include ::ceph::profile::mon
220 if str2bool(hiera('enable_ceph_storage', 'false')) {
221 include ::ceph::profile::client
222 include ::ceph::profile::osd
227 if hiera('step') >= 3 {
231 #TODO: need a cleanup-keystone-tokens.sh solution here
233 'ec2/driver': value => 'keystone.contrib.ec2.backends.sql.Ec2';
235 file { [ '/etc/keystone/ssl', '/etc/keystone/ssl/certs', '/etc/keystone/ssl/private' ]:
236 ensure => 'directory',
239 require => Package['keystone'],
241 file { '/etc/keystone/ssl/certs/signing_cert.pem':
242 content => hiera('keystone_signing_certificate'),
245 notify => Service['keystone'],
246 require => File['/etc/keystone/ssl/certs'],
248 file { '/etc/keystone/ssl/private/signing_key.pem':
249 content => hiera('keystone_signing_key'),
252 notify => Service['keystone'],
253 require => File['/etc/keystone/ssl/private'],
255 file { '/etc/keystone/ssl/certs/ca.pem':
256 content => hiera('keystone_ca_certificate'),
259 notify => Service['keystone'],
260 require => File['/etc/keystone/ssl/certs'],
263 # TODO: notifications, scrubber, etc.
265 include ::glance::api
266 include ::glance::registry
267 include ::glance::backend::swift
270 glance_api_servers => join([hiera('glance_protocol'), '://', hiera('controller_virtual_ip'), ':', hiera('glance_port')]),
275 include ::nova::conductor
276 include ::nova::consoleauth
277 include ::nova::network::neutron
278 include ::nova::vncproxy
279 include ::nova::scheduler
282 include ::neutron::server
283 include ::neutron::agents::dhcp
284 include ::neutron::agents::l3
286 file { '/etc/neutron/dnsmasq-neutron.conf':
287 content => hiera('neutron_dnsmasq_options'),
290 notify => Service['neutron-dhcp-service'],
291 require => Package['neutron'],
294 class { 'neutron::plugins::ml2':
295 flat_networks => split(hiera('neutron_flat_networks'), ','),
296 tenant_network_types => [hiera('neutron_tenant_network_type')],
297 type_drivers => [hiera('neutron_tenant_network_type')],
300 class { 'neutron::agents::ml2::ovs':
301 bridge_mappings => split(hiera('neutron_bridge_mappings'), ','),
302 tunnel_types => split(hiera('neutron_tunnel_types'), ','),
305 class { 'neutron::agents::metadata':
306 auth_url => join(['http://', hiera('controller_virtual_ip'), ':35357/v2.0']),
309 Service['neutron-server'] -> Service['neutron-dhcp-service']
310 Service['neutron-server'] -> Service['neutron-l3']
311 Service['neutron-server'] -> Service['neutron-ovs-agent-service']
312 Service['neutron-server'] -> Service['neutron-metadata']
315 include ::cinder::api
316 include ::cinder::glance
317 include ::cinder::scheduler
318 include ::cinder::volume
319 class {'cinder::setup_test_volume':
320 size => join([hiera('cinder_lvm_loop_device_size'), 'M']),
323 $cinder_enable_iscsi = hiera('cinder_enable_iscsi_backend', true)
324 if $cinder_enable_iscsi {
325 $cinder_iscsi_backend = 'tripleo_iscsi'
327 cinder::backend::iscsi { $cinder_iscsi_backend :
328 iscsi_ip_address => hiera('cinder_iscsi_ip_address'),
329 iscsi_helper => hiera('cinder_iscsi_helper'),
336 pg_num => hiera('ceph::profile::params::osd_pool_default_pg_num'),
337 pgp_num => hiera('ceph::profile::params::osd_pool_default_pgp_num'),
338 size => hiera('ceph::profile::params::osd_pool_default_size'),
341 $ceph_pools = hiera('ceph_pools')
342 ceph::pool { $ceph_pools : }
345 if $cinder_enable_rbd_backend {
346 $cinder_rbd_backend = 'tripleo_ceph'
349 "${cinder_rbd_backend}/host": value => 'hostgroup';
352 cinder::backend::rbd { $cinder_rbd_backend :
353 rbd_pool => 'volumes',
354 rbd_user => 'openstack',
355 rbd_secret_uuid => hiera('ceph::profile::params::fsid'),
356 require => Ceph::Pool['volumes'],
360 $cinder_enabled_backends = delete_undef_values([$cinder_iscsi_backend, $cinder_rbd_backend])
361 class { '::cinder::backends' :
362 enabled_backends => $cinder_enabled_backends,
367 include ::swift::proxy
368 include ::swift::proxy::proxy_logging
369 include ::swift::proxy::healthcheck
370 include ::swift::proxy::cache
371 include ::swift::proxy::keystone
372 include ::swift::proxy::authtoken
373 include ::swift::proxy::staticweb
374 include ::swift::proxy::ceilometer
375 include ::swift::proxy::ratelimit
376 include ::swift::proxy::catch_errors
377 include ::swift::proxy::tempurl
378 include ::swift::proxy::formpost
381 if str2bool(hiera('enable_swift_storage', 'true')) {
382 class {'swift::storage::all':
383 mount_check => str2bool(hiera('swift_mount_check'))
385 if(!defined(File['/srv/node'])) {
390 require => Package['openstack-swift'],
393 $swift_components = ['account', 'container', 'object']
394 swift::storage::filter::recon { $swift_components : }
395 swift::storage::filter::healthcheck { $swift_components : }
400 include ::ceilometer::api
401 include ::ceilometer::agent::notification
402 include ::ceilometer::agent::central
403 include ::ceilometer::alarm::notifier
404 include ::ceilometer::alarm::evaluator
405 include ::ceilometer::expirer
406 include ::ceilometer::collector
407 class { '::ceilometer::db' :
408 database_connection => $ceilometer_mongodb_conn_string,
410 class { 'ceilometer::agent::auth':
411 auth_url => join(['http://', hiera('controller_virtual_ip'), ':5000/v2.0']),
414 Cron <| title == 'ceilometer-expirer' |> { command => "sleep $((\$(od -A n -t d -N 3 /dev/urandom) % 86400)) && ${::ceilometer::params::expirer_command}" }
419 include ::heat::api_cfn
420 include ::heat::api_cloudwatch
421 include ::heat::engine
423 $snmpd_user = hiera('snmpd_readonly_user_name')
424 snmp::snmpv3_user { $snmpd_user:
426 authpass => hiera('snmpd_readonly_user_password'),
429 agentaddress => ['udp:161','udp6:[::1]:161'],
430 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' ],