1 # Copyright 2015 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 $::hostname == downcase(hiera('bootstrap_nodeid')) {
28 $pacemaker_master = true
30 $pacemaker_master = false
33 if hiera('step') >= 1 {
35 $controller_node_ips = split(hiera('controller_node_ips'), ',')
37 class { '::tripleo::loadbalancer' :
38 controller_hosts => $controller_node_ips,
42 $pacemaker_cluster_members = regsubst(hiera('controller_node_ips'), ',', ' ', 'G')
46 class { '::pacemaker':
47 hacluster_pwd => hiera('hacluster_pwd'),
49 class { '::pacemaker::corosync':
50 cluster_members => $pacemaker_cluster_members,
51 setup_cluster => $pacemaker_master,
53 class { '::pacemaker::stonith':
56 if $pacemaker_master {
57 $control_vip = hiera('tripleo::loadbalancer::controller_virtual_ip')
58 pacemaker::resource::ip { 'control_vip':
59 ip_address => $control_vip,
61 $public_vip = hiera('tripleo::loadbalancer::public_virtual_ip')
62 pacemaker::resource::ip { 'public_vip':
63 ip_address => $public_vip,
65 pacemaker::resource::systemd { 'haproxy':
70 Class['::pacemaker::corosync'] -> Pacemaker::Resource::Systemd <| |>
74 if hiera('step') >= 2 {
76 if count(hiera('ntp::servers')) > 0 {
81 if downcase(hiera('ceilometer_backend')) == 'mongodb' {
82 include ::mongodb::globals
84 class {'::mongodb::server' :
85 service_ensure => undef
87 $mongo_node_ips = split(hiera('mongo_node_ips'), ',')
88 $mongo_node_ips_with_port = suffix($mongo_node_ips, ':27017')
89 $mongo_node_string = join($mongo_node_ips_with_port, ',')
91 $mongodb_replset = hiera('mongodb::server::replset')
92 $ceilometer_mongodb_conn_string = "mongodb://${mongo_node_string}/ceilometer?replicaSet=${mongodb_replset}"
93 if downcase(hiera('bootstrap_nodeid')) == $::hostname {
95 pacemaker::resource::systemd { 'mongod' :
96 options => "op start timeout=120s",
98 before => Exec['mongodb-ready'],
100 # NOTE (spredzy) : The replset can only be run
101 # once all the nodes have joined the cluster.
102 $mongodb_cluster_ready_command = join(suffix(prefix($mongo_node_ips, '/bin/nc -w1 '), ' 27017 < /dev/null'), ' && ')
103 exec { 'mongodb-ready' :
104 command => $mongodb_cluster_ready_command,
108 before => Mongodb_replset[$mongodb_replset],
111 mongodb_replset { $mongodb_replset :
112 members => $mongo_node_ips_with_port,
118 $redis_node_ips = split(hiera('redis_node_ips'), ',')
119 $redis_master_hostname = downcase(hiera('bootstrap_nodeid'))
121 if $redis_master_hostname == $::hostname {
124 $slaveof = "${redis_master_hostname} 6379"
130 if count($redis_node_ips) > 1 {
131 Class['::tripleo::redis_notification'] -> Service['redis-sentinel']
132 include ::redis::sentinel
133 class {'::tripleo::redis_notification' :
134 haproxy_monitor_ip => hiera('tripleo::loadbalancer::controller_virtual_ip'),
138 if str2bool(hiera('enable_galera', 'true')) {
139 $mysql_config_file = '/etc/my.cnf.d/galera.cnf'
141 $mysql_config_file = '/etc/my.cnf.d/server.cnf'
144 class { 'mysql::server':
145 config_file => $mysql_config_file,
146 override_options => {
148 'bind-address' => hiera('controller_host')
153 # FIXME: this should only occur on the bootstrap host (ditto for db syncs)
154 # Create all the database schemas
155 # Example DSN format: mysql://user:password@host/dbname
156 $allowed_hosts = ['%',hiera('controller_host')]
157 $keystone_dsn = split(hiera('keystone::database_connection'), '[@:/?]')
158 class { 'keystone::db::mysql':
159 user => $keystone_dsn[3],
160 password => $keystone_dsn[4],
161 host => $keystone_dsn[5],
162 dbname => $keystone_dsn[6],
163 allowed_hosts => $allowed_hosts,
165 $glance_dsn = split(hiera('glance::api::database_connection'), '[@:/?]')
166 class { 'glance::db::mysql':
167 user => $glance_dsn[3],
168 password => $glance_dsn[4],
169 host => $glance_dsn[5],
170 dbname => $glance_dsn[6],
171 allowed_hosts => $allowed_hosts,
173 $nova_dsn = split(hiera('nova::database_connection'), '[@:/?]')
174 class { 'nova::db::mysql':
175 user => $nova_dsn[3],
176 password => $nova_dsn[4],
177 host => $nova_dsn[5],
178 dbname => $nova_dsn[6],
179 allowed_hosts => $allowed_hosts,
181 $neutron_dsn = split(hiera('neutron::server::database_connection'), '[@:/?]')
182 class { 'neutron::db::mysql':
183 user => $neutron_dsn[3],
184 password => $neutron_dsn[4],
185 host => $neutron_dsn[5],
186 dbname => $neutron_dsn[6],
187 allowed_hosts => $allowed_hosts,
189 $cinder_dsn = split(hiera('cinder::database_connection'), '[@:/?]')
190 class { 'cinder::db::mysql':
191 user => $cinder_dsn[3],
192 password => $cinder_dsn[4],
193 host => $cinder_dsn[5],
194 dbname => $cinder_dsn[6],
195 allowed_hosts => $allowed_hosts,
197 $heat_dsn = split(hiera('heat::database_connection'), '[@:/?]')
198 class { 'heat::db::mysql':
199 user => $heat_dsn[3],
200 password => $heat_dsn[4],
201 host => $heat_dsn[5],
202 dbname => $heat_dsn[6],
203 allowed_hosts => $allowed_hosts,
205 if downcase(hiera('ceilometer_backend')) == 'mysql' {
206 $ceilometer_dsn = split(hiera('ceilometer_mysql_conn_string'), '[@:/?]')
207 class { 'ceilometer::db::mysql':
208 user => $ceilometer_dsn[3],
209 password => $ceilometer_dsn[4],
210 host => $ceilometer_dsn[5],
211 dbname => $ceilometer_dsn[6],
212 allowed_hosts => $allowed_hosts,
216 # the module ignores erlang_cookie if cluster_config is false
217 file { '/var/lib/rabbitmq/.erlang.cookie':
222 content => hiera('rabbitmq::erlang_cookie'),
225 class { '::rabbitmq':
226 service_manage => false,
227 environment_variables => {
228 'RABBITMQ_NODENAME' => "rabbit@$::hostname",
231 if $pacemaker_master {
232 pacemaker::resource::ocf { 'rabbitmq':
233 resource_name => 'heartbeat:rabbitmq-cluster',
234 options => 'set_policy=\'ha-all ^(?!amq\.).* {"ha-mode":"all"}\'',
236 require => Class['::rabbitmq'],
240 # pre-install swift here so we can build rings
243 $cinder_enable_rbd_backend = hiera('cinder_enable_rbd_backend', false)
244 $enable_ceph = $cinder_enable_rbd_backend
247 class { 'ceph::profile::params':
248 mon_initial_members => downcase(hiera('ceph_mon_initial_members'))
250 include ::ceph::profile::mon
253 if str2bool(hiera('enable_ceph_storage', 'false')) {
254 include ::ceph::profile::client
255 include ::ceph::profile::osd
260 if hiera('step') >= 3 {
264 #TODO: need a cleanup-keystone-tokens.sh solution here
266 'ec2/driver': value => 'keystone.contrib.ec2.backends.sql.Ec2';
268 file { [ '/etc/keystone/ssl', '/etc/keystone/ssl/certs', '/etc/keystone/ssl/private' ]:
269 ensure => 'directory',
272 require => Package['keystone'],
274 file { '/etc/keystone/ssl/certs/signing_cert.pem':
275 content => hiera('keystone_signing_certificate'),
278 notify => Service['keystone'],
279 require => File['/etc/keystone/ssl/certs'],
281 file { '/etc/keystone/ssl/private/signing_key.pem':
282 content => hiera('keystone_signing_key'),
285 notify => Service['keystone'],
286 require => File['/etc/keystone/ssl/private'],
288 file { '/etc/keystone/ssl/certs/ca.pem':
289 content => hiera('keystone_ca_certificate'),
292 notify => Service['keystone'],
293 require => File['/etc/keystone/ssl/certs'],
296 $glance_backend = downcase(hiera('glance_backend', 'swift'))
297 case $glance_backend {
298 swift: { $glance_store = 'glance.store.swift.Store' }
299 file: { $glance_store = 'glance.store.filesystem.Store' }
300 rbd: { $glance_store = 'glance.store.rbd.Store' }
301 default: { fail('Unrecognized glance_backend parameter.') }
304 # TODO: notifications, scrubber, etc.
306 class { 'glance::api':
307 known_stores => [$glance_store]
309 include ::glance::registry
310 include join(['::glance::backend::', $glance_backend])
313 glance_api_servers => join([hiera('glance_protocol'), '://', hiera('controller_virtual_ip'), ':', hiera('glance_port')]),
318 include ::nova::conductor
319 include ::nova::consoleauth
320 include ::nova::network::neutron
321 include ::nova::vncproxy
322 include ::nova::scheduler
325 include ::neutron::server
326 include ::neutron::agents::dhcp
327 include ::neutron::agents::l3
329 file { '/etc/neutron/dnsmasq-neutron.conf':
330 content => hiera('neutron_dnsmasq_options'),
333 notify => Service['neutron-dhcp-service'],
334 require => Package['neutron'],
337 class { 'neutron::plugins::ml2':
338 flat_networks => split(hiera('neutron_flat_networks'), ','),
339 tenant_network_types => [hiera('neutron_tenant_network_type')],
340 type_drivers => [hiera('neutron_tenant_network_type')],
343 class { 'neutron::agents::ml2::ovs':
344 bridge_mappings => split(hiera('neutron_bridge_mappings'), ','),
345 tunnel_types => split(hiera('neutron_tunnel_types'), ','),
348 class { 'neutron::agents::metadata':
349 auth_url => join(['http://', hiera('controller_virtual_ip'), ':35357/v2.0']),
352 Service['neutron-server'] -> Service['neutron-dhcp-service']
353 Service['neutron-server'] -> Service['neutron-l3']
354 Service['neutron-server'] -> Service['neutron-ovs-agent-service']
355 Service['neutron-server'] -> Service['neutron-metadata']
358 include ::cinder::api
359 include ::cinder::glance
360 include ::cinder::scheduler
361 include ::cinder::volume
362 class {'cinder::setup_test_volume':
363 size => join([hiera('cinder_lvm_loop_device_size'), 'M']),
366 $cinder_enable_iscsi = hiera('cinder_enable_iscsi_backend', true)
367 if $cinder_enable_iscsi {
368 $cinder_iscsi_backend = 'tripleo_iscsi'
370 cinder::backend::iscsi { $cinder_iscsi_backend :
371 iscsi_ip_address => hiera('cinder_iscsi_ip_address'),
372 iscsi_helper => hiera('cinder_iscsi_helper'),
379 pg_num => hiera('ceph::profile::params::osd_pool_default_pg_num'),
380 pgp_num => hiera('ceph::profile::params::osd_pool_default_pgp_num'),
381 size => hiera('ceph::profile::params::osd_pool_default_size'),
384 $ceph_pools = hiera('ceph_pools')
385 ceph::pool { $ceph_pools : }
388 if $cinder_enable_rbd_backend {
389 $cinder_rbd_backend = 'tripleo_ceph'
392 "${cinder_rbd_backend}/host": value => 'hostgroup';
395 cinder::backend::rbd { $cinder_rbd_backend :
396 rbd_pool => 'volumes',
397 rbd_user => 'openstack',
398 rbd_secret_uuid => hiera('ceph::profile::params::fsid'),
399 require => Ceph::Pool['volumes'],
403 $cinder_enabled_backends = delete_undef_values([$cinder_iscsi_backend, $cinder_rbd_backend])
404 class { '::cinder::backends' :
405 enabled_backends => $cinder_enabled_backends,
410 include ::swift::proxy
411 include ::swift::proxy::proxy_logging
412 include ::swift::proxy::healthcheck
413 include ::swift::proxy::cache
414 include ::swift::proxy::keystone
415 include ::swift::proxy::authtoken
416 include ::swift::proxy::staticweb
417 include ::swift::proxy::ceilometer
418 include ::swift::proxy::ratelimit
419 include ::swift::proxy::catch_errors
420 include ::swift::proxy::tempurl
421 include ::swift::proxy::formpost
424 if str2bool(hiera('enable_swift_storage', 'true')) {
425 class {'swift::storage::all':
426 mount_check => str2bool(hiera('swift_mount_check'))
428 if(!defined(File['/srv/node'])) {
433 require => Package['openstack-swift'],
436 $swift_components = ['account', 'container', 'object']
437 swift::storage::filter::recon { $swift_components : }
438 swift::storage::filter::healthcheck { $swift_components : }
442 $ceilometer_backend = downcase(hiera('ceilometer_backend'))
443 case $ceilometer_backend {
445 $ceilometer_database_connection = hiera('ceilometer_mysql_conn_string')
448 $ceilometer_database_connection = $ceilometer_mongodb_conn_string
452 include ::ceilometer::api
453 include ::ceilometer::agent::notification
454 include ::ceilometer::agent::central
455 include ::ceilometer::alarm::notifier
456 include ::ceilometer::alarm::evaluator
457 include ::ceilometer::expirer
458 include ::ceilometer::collector
459 class { '::ceilometer::db' :
460 database_connection => $ceilometer_database_connection,
462 class { 'ceilometer::agent::auth':
463 auth_url => join(['http://', hiera('controller_virtual_ip'), ':5000/v2.0']),
466 Cron <| title == 'ceilometer-expirer' |> { command => "sleep $((\$(od -A n -t d -N 3 /dev/urandom) % 86400)) && ${::ceilometer::params::expirer_command}" }
471 include ::heat::api_cfn
472 include ::heat::api_cloudwatch
473 include ::heat::engine
476 $vhost_params = { add_listen => false }
478 cache_server_ip => split(hiera('memcache_node_ips', '127.0.0.1'), ','),
479 vhost_extra_params => $vhost_params,
482 $snmpd_user = hiera('snmpd_readonly_user_name')
483 snmp::snmpv3_user { $snmpd_user:
485 authpass => hiera('snmpd_readonly_user_password'),
488 agentaddress => ['udp:161','udp6:[::1]:161'],
489 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' ],