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 $enable_pacemaker = str2bool(hiera('enable_pacemaker'))
28 $enable_keepalived = !$enable_pacemaker
29 if $::hostname == downcase(hiera('bootstrap_nodeid')) {
30 $pacemaker_master = true
32 $pacemaker_master = false
35 if hiera('step') >= 1 {
37 $controller_node_ips = split(hiera('controller_node_ips'), ',')
39 class { '::tripleo::loadbalancer' :
40 controller_hosts => $controller_node_ips,
41 manage_vip => $enable_keepalived,
44 if $enable_pacemaker {
45 $pacemaker_cluster_members = regsubst(hiera('controller_node_ips'), ',', ' ', 'G')
49 class { '::pacemaker':
50 hacluster_pwd => hiera('hacluster_pwd'),
52 class { '::pacemaker::corosync':
53 cluster_members => $pacemaker_cluster_members,
54 setup_cluster => $pacemaker_master,
56 class { '::pacemaker::stonith':
59 if $pacemaker_master {
60 $control_vip = hiera('tripleo::loadbalancer::controller_virtual_ip')
61 pacemaker::resource::ip { 'control_vip':
62 ip_address => $control_vip,
64 $public_vip = hiera('tripleo::loadbalancer::public_virtual_ip')
65 pacemaker::resource::ip { 'public_vip':
66 ip_address => $public_vip,
68 pacemaker::resource::systemd { 'haproxy':
73 Class['::pacemaker::corosync'] -> Pacemaker::Resource::Systemd <| |>
78 if hiera('step') >= 2 {
80 if count(hiera('ntp::servers')) > 0 {
85 if downcase(hiera('ceilometer_backend')) == 'mongodb' {
86 include ::mongodb::globals
88 if $enable_pacemaker {
89 $mongodb_service_ensure = undef
91 $mongodb_service_ensure = 'running'
94 class {'::mongodb::server' :
95 service_ensure => $mongodb_service_ensure,
97 $mongo_node_ips = split(hiera('mongo_node_ips'), ',')
98 $mongo_node_ips_with_port = suffix($mongo_node_ips, ':27017')
99 $mongo_node_string = join($mongo_node_ips_with_port, ',')
101 $mongodb_replset = hiera('mongodb::server::replset')
102 $ceilometer_mongodb_conn_string = "mongodb://${mongo_node_string}/ceilometer?replicaSet=${mongodb_replset}"
103 if downcase(hiera('bootstrap_nodeid')) == $::hostname {
105 if $enable_pacemaker {
106 pacemaker::resource::systemd { 'mongod' :
107 options => "op start timeout=120s",
109 before => Exec['mongodb-ready'],
111 # NOTE (spredzy) : The replset can only be run
112 # once all the nodes have joined the cluster.
113 $mongodb_cluster_ready_command = join(suffix(prefix($mongo_node_ips, '/bin/nc -w1 '), ' 27017 < /dev/null'), ' && ')
114 exec { 'mongodb-ready' :
115 command => $mongodb_cluster_ready_command,
119 before => Mongodb_replset[$mongodb_replset],
124 mongodb_replset { $mongodb_replset :
125 members => $mongo_node_ips_with_port,
131 $redis_node_ips = split(hiera('redis_node_ips'), ',')
132 $redis_master_hostname = downcase(hiera('bootstrap_nodeid'))
134 if $redis_master_hostname == $::hostname {
137 $slaveof = "${redis_master_hostname} 6379"
143 if count($redis_node_ips) > 1 {
144 Class['::tripleo::redis_notification'] -> Service['redis-sentinel']
145 include ::redis::sentinel
146 class {'::tripleo::redis_notification' :
147 haproxy_monitor_ip => hiera('tripleo::loadbalancer::controller_virtual_ip'),
151 if str2bool(hiera('enable_galera', 'true')) {
152 $mysql_config_file = '/etc/my.cnf.d/galera.cnf'
154 $mysql_config_file = '/etc/my.cnf.d/server.cnf'
157 class { 'mysql::server':
158 config_file => $mysql_config_file,
159 override_options => {
161 'bind-address' => hiera('controller_host')
166 # FIXME: this should only occur on the bootstrap host (ditto for db syncs)
167 # Create all the database schemas
168 # Example DSN format: mysql://user:password@host/dbname
169 $allowed_hosts = ['%',hiera('controller_host')]
170 $keystone_dsn = split(hiera('keystone::database_connection'), '[@:/?]')
171 class { 'keystone::db::mysql':
172 user => $keystone_dsn[3],
173 password => $keystone_dsn[4],
174 host => $keystone_dsn[5],
175 dbname => $keystone_dsn[6],
176 allowed_hosts => $allowed_hosts,
178 $glance_dsn = split(hiera('glance::api::database_connection'), '[@:/?]')
179 class { 'glance::db::mysql':
180 user => $glance_dsn[3],
181 password => $glance_dsn[4],
182 host => $glance_dsn[5],
183 dbname => $glance_dsn[6],
184 allowed_hosts => $allowed_hosts,
186 $nova_dsn = split(hiera('nova::database_connection'), '[@:/?]')
187 class { 'nova::db::mysql':
188 user => $nova_dsn[3],
189 password => $nova_dsn[4],
190 host => $nova_dsn[5],
191 dbname => $nova_dsn[6],
192 allowed_hosts => $allowed_hosts,
194 $neutron_dsn = split(hiera('neutron::server::database_connection'), '[@:/?]')
195 class { 'neutron::db::mysql':
196 user => $neutron_dsn[3],
197 password => $neutron_dsn[4],
198 host => $neutron_dsn[5],
199 dbname => $neutron_dsn[6],
200 allowed_hosts => $allowed_hosts,
202 $cinder_dsn = split(hiera('cinder::database_connection'), '[@:/?]')
203 class { 'cinder::db::mysql':
204 user => $cinder_dsn[3],
205 password => $cinder_dsn[4],
206 host => $cinder_dsn[5],
207 dbname => $cinder_dsn[6],
208 allowed_hosts => $allowed_hosts,
210 $heat_dsn = split(hiera('heat::database_connection'), '[@:/?]')
211 class { 'heat::db::mysql':
212 user => $heat_dsn[3],
213 password => $heat_dsn[4],
214 host => $heat_dsn[5],
215 dbname => $heat_dsn[6],
216 allowed_hosts => $allowed_hosts,
218 if downcase(hiera('ceilometer_backend')) == 'mysql' {
219 $ceilometer_dsn = split(hiera('ceilometer_mysql_conn_string'), '[@:/?]')
220 class { 'ceilometer::db::mysql':
221 user => $ceilometer_dsn[3],
222 password => $ceilometer_dsn[4],
223 host => $ceilometer_dsn[5],
224 dbname => $ceilometer_dsn[6],
225 allowed_hosts => $allowed_hosts,
229 if $enable_pacemaker {
230 # the module ignores erlang_cookie if cluster_config is false
231 file { '/var/lib/rabbitmq/.erlang.cookie':
236 content => hiera('rabbitmq::erlang_cookie'),
239 class { '::rabbitmq':
240 service_manage => false,
241 environment_variables => {
242 'RABBITMQ_NODENAME' => "rabbit@$::hostname",
245 if $pacemaker_master {
246 pacemaker::resource::ocf { 'rabbitmq':
247 resource_name => 'heartbeat:rabbitmq-cluster',
248 options => 'set_policy=\'ha-all ^(?!amq\.).* {"ha-mode":"all"}\'',
250 require => Class['::rabbitmq'],
254 $rabbit_nodes = split(hiera('rabbit_node_ips'), ',')
255 if count($rabbit_nodes) > 1 {
256 class { '::rabbitmq':
257 config_cluster => true,
258 cluster_nodes => $rabbit_nodes,
260 rabbitmq_policy { 'ha-all@/':
261 pattern => '^(?!amq\.).*',
271 # pre-install swift here so we can build rings
274 $cinder_enable_rbd_backend = hiera('cinder_enable_rbd_backend', false)
275 $enable_ceph = $cinder_enable_rbd_backend
278 class { 'ceph::profile::params':
279 mon_initial_members => downcase(hiera('ceph_mon_initial_members'))
281 include ::ceph::profile::mon
284 if str2bool(hiera('enable_ceph_storage', 'false')) {
285 include ::ceph::profile::client
286 include ::ceph::profile::osd
291 if hiera('step') >= 3 {
295 #TODO: need a cleanup-keystone-tokens.sh solution here
297 'ec2/driver': value => 'keystone.contrib.ec2.backends.sql.Ec2';
299 file { [ '/etc/keystone/ssl', '/etc/keystone/ssl/certs', '/etc/keystone/ssl/private' ]:
300 ensure => 'directory',
303 require => Package['keystone'],
305 file { '/etc/keystone/ssl/certs/signing_cert.pem':
306 content => hiera('keystone_signing_certificate'),
309 notify => Service['keystone'],
310 require => File['/etc/keystone/ssl/certs'],
312 file { '/etc/keystone/ssl/private/signing_key.pem':
313 content => hiera('keystone_signing_key'),
316 notify => Service['keystone'],
317 require => File['/etc/keystone/ssl/private'],
319 file { '/etc/keystone/ssl/certs/ca.pem':
320 content => hiera('keystone_ca_certificate'),
323 notify => Service['keystone'],
324 require => File['/etc/keystone/ssl/certs'],
327 $glance_backend = downcase(hiera('glance_backend', 'swift'))
328 case $glance_backend {
329 swift: { $glance_store = 'glance.store.swift.Store' }
330 file: { $glance_store = 'glance.store.filesystem.Store' }
331 rbd: { $glance_store = 'glance.store.rbd.Store' }
332 default: { fail('Unrecognized glance_backend parameter.') }
335 # TODO: notifications, scrubber, etc.
337 class { 'glance::api':
338 known_stores => [$glance_store]
340 include ::glance::registry
341 include join(['::glance::backend::', $glance_backend])
344 glance_api_servers => join([hiera('glance_protocol'), '://', hiera('controller_virtual_ip'), ':', hiera('glance_port')]),
349 include ::nova::conductor
350 include ::nova::consoleauth
351 include ::nova::network::neutron
352 include ::nova::vncproxy
353 include ::nova::scheduler
356 include ::neutron::server
357 include ::neutron::agents::dhcp
358 include ::neutron::agents::l3
360 file { '/etc/neutron/dnsmasq-neutron.conf':
361 content => hiera('neutron_dnsmasq_options'),
364 notify => Service['neutron-dhcp-service'],
365 require => Package['neutron'],
368 class { 'neutron::plugins::ml2':
369 flat_networks => split(hiera('neutron_flat_networks'), ','),
370 tenant_network_types => [hiera('neutron_tenant_network_type')],
371 type_drivers => [hiera('neutron_tenant_network_type')],
374 class { 'neutron::agents::ml2::ovs':
375 bridge_mappings => split(hiera('neutron_bridge_mappings'), ','),
376 tunnel_types => split(hiera('neutron_tunnel_types'), ','),
379 class { 'neutron::agents::metadata':
380 auth_url => join(['http://', hiera('controller_virtual_ip'), ':35357/v2.0']),
383 Service['neutron-server'] -> Service['neutron-dhcp-service']
384 Service['neutron-server'] -> Service['neutron-l3']
385 Service['neutron-server'] -> Service['neutron-ovs-agent-service']
386 Service['neutron-server'] -> Service['neutron-metadata']
389 include ::cinder::api
390 include ::cinder::glance
391 include ::cinder::scheduler
392 include ::cinder::volume
393 class {'cinder::setup_test_volume':
394 size => join([hiera('cinder_lvm_loop_device_size'), 'M']),
397 $cinder_enable_iscsi = hiera('cinder_enable_iscsi_backend', true)
398 if $cinder_enable_iscsi {
399 $cinder_iscsi_backend = 'tripleo_iscsi'
401 cinder::backend::iscsi { $cinder_iscsi_backend :
402 iscsi_ip_address => hiera('cinder_iscsi_ip_address'),
403 iscsi_helper => hiera('cinder_iscsi_helper'),
410 pg_num => hiera('ceph::profile::params::osd_pool_default_pg_num'),
411 pgp_num => hiera('ceph::profile::params::osd_pool_default_pgp_num'),
412 size => hiera('ceph::profile::params::osd_pool_default_size'),
415 $ceph_pools = hiera('ceph_pools')
416 ceph::pool { $ceph_pools : }
419 if $cinder_enable_rbd_backend {
420 $cinder_rbd_backend = 'tripleo_ceph'
423 "${cinder_rbd_backend}/host": value => 'hostgroup';
426 cinder::backend::rbd { $cinder_rbd_backend :
427 rbd_pool => 'volumes',
428 rbd_user => 'openstack',
429 rbd_secret_uuid => hiera('ceph::profile::params::fsid'),
430 require => Ceph::Pool['volumes'],
434 $cinder_enabled_backends = delete_undef_values([$cinder_iscsi_backend, $cinder_rbd_backend])
435 class { '::cinder::backends' :
436 enabled_backends => $cinder_enabled_backends,
441 include ::swift::proxy
442 include ::swift::proxy::proxy_logging
443 include ::swift::proxy::healthcheck
444 include ::swift::proxy::cache
445 include ::swift::proxy::keystone
446 include ::swift::proxy::authtoken
447 include ::swift::proxy::staticweb
448 include ::swift::proxy::ceilometer
449 include ::swift::proxy::ratelimit
450 include ::swift::proxy::catch_errors
451 include ::swift::proxy::tempurl
452 include ::swift::proxy::formpost
455 if str2bool(hiera('enable_swift_storage', 'true')) {
456 class {'swift::storage::all':
457 mount_check => str2bool(hiera('swift_mount_check'))
459 if(!defined(File['/srv/node'])) {
464 require => Package['openstack-swift'],
467 $swift_components = ['account', 'container', 'object']
468 swift::storage::filter::recon { $swift_components : }
469 swift::storage::filter::healthcheck { $swift_components : }
473 $ceilometer_backend = downcase(hiera('ceilometer_backend'))
474 case $ceilometer_backend {
476 $ceilometer_database_connection = hiera('ceilometer_mysql_conn_string')
479 $ceilometer_database_connection = $ceilometer_mongodb_conn_string
483 include ::ceilometer::api
484 include ::ceilometer::agent::notification
485 include ::ceilometer::agent::central
486 include ::ceilometer::alarm::notifier
487 include ::ceilometer::alarm::evaluator
488 include ::ceilometer::expirer
489 include ::ceilometer::collector
490 class { '::ceilometer::db' :
491 database_connection => $ceilometer_database_connection,
493 class { 'ceilometer::agent::auth':
494 auth_url => join(['http://', hiera('controller_virtual_ip'), ':5000/v2.0']),
497 Cron <| title == 'ceilometer-expirer' |> { command => "sleep $((\$(od -A n -t d -N 3 /dev/urandom) % 86400)) && ${::ceilometer::params::expirer_command}" }
502 include ::heat::api_cfn
503 include ::heat::api_cloudwatch
504 include ::heat::engine
506 $snmpd_user = hiera('snmpd_readonly_user_name')
507 snmp::snmpv3_user { $snmpd_user:
509 authpass => hiera('snmpd_readonly_user_password'),
512 agentaddress => ['udp:161','udp6:[::1]:161'],
513 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' ],