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 include ::tripleo::loadbalancer
33 if hiera('step') >= 2 {
35 if count(hiera('ntp::servers')) > 0 {
40 class { 'mysql::server':
43 'bind-address' => hiera('controller_host')
48 # FIXME: this should only occur on the bootstrap host (ditto for db syncs)
49 # Create all the database schemas
50 # Example DSN format: mysql://user:password@host/dbname
51 $allowed_hosts = ['%',hiera('controller_host')]
52 $keystone_dsn = split(hiera('keystone::database_connection'), '[@:/?]')
53 class { 'keystone::db::mysql':
54 user => $keystone_dsn[3],
55 password => $keystone_dsn[4],
56 host => $keystone_dsn[5],
57 dbname => $keystone_dsn[6],
58 allowed_hosts => $allowed_hosts,
60 $glance_dsn = split(hiera('glance::api::database_connection'), '[@:/?]')
61 class { 'glance::db::mysql':
62 user => $glance_dsn[3],
63 password => $glance_dsn[4],
64 host => $glance_dsn[5],
65 dbname => $glance_dsn[6],
66 allowed_hosts => $allowed_hosts,
68 $nova_dsn = split(hiera('nova::database_connection'), '[@:/?]')
69 class { 'nova::db::mysql':
71 password => $nova_dsn[4],
73 dbname => $nova_dsn[6],
74 allowed_hosts => $allowed_hosts,
76 $neutron_dsn = split(hiera('neutron::server::database_connection'), '[@:/?]')
77 class { 'neutron::db::mysql':
78 user => $neutron_dsn[3],
79 password => $neutron_dsn[4],
80 host => $neutron_dsn[5],
81 dbname => $neutron_dsn[6],
82 allowed_hosts => $allowed_hosts,
84 $cinder_dsn = split(hiera('cinder::database_connection'), '[@:/?]')
85 class { 'cinder::db::mysql':
86 user => $cinder_dsn[3],
87 password => $cinder_dsn[4],
88 host => $cinder_dsn[5],
89 dbname => $cinder_dsn[6],
90 allowed_hosts => $allowed_hosts,
92 $heat_dsn = split(hiera('heat::database_connection'), '[@:/?]')
93 class { 'heat::db::mysql':
95 password => $heat_dsn[4],
97 dbname => $heat_dsn[6],
98 allowed_hosts => $allowed_hosts,
100 $ceilometer_dsn = split(hiera('ceilometer::db::database_connection'), '[@:/?]')
101 class { 'ceilometer::db::mysql':
102 user => $ceilometer_dsn[3],
103 password => $ceilometer_dsn[4],
104 host => $ceilometer_dsn[5],
105 dbname => $ceilometer_dsn[6],
106 allowed_hosts => $allowed_hosts,
109 if $::osfamily == 'RedHat' {
110 $rabbit_provider = 'yum'
112 $rabbit_provider = undef
115 Class['rabbitmq'] -> Rabbitmq_vhost <| |>
116 Class['rabbitmq'] -> Rabbitmq_user <| |>
117 Class['rabbitmq'] -> Rabbitmq_user_permissions <| |>
119 $rabbit_nodes = split(downcase(hiera('rabbit_nodes', $::hostname)), ',')
120 if count($rabbit_nodes) > 1 {
121 $rabbit_cluster = true
124 $rabbit_cluster = false
127 package_provider => $rabbit_provider,
128 config_cluster => $rabbit_cluster,
129 cluster_nodes => $rabbit_nodes,
130 node_ip_address => hiera('controller_host'),
133 rabbitmq_vhost { '/':
134 provider => 'rabbitmqctl',
136 rabbitmq_user { ['nova','glance','neutron','cinder','ceilometer','heat']:
138 password => hiera('rabbit_password'),
139 provider => 'rabbitmqctl',
142 rabbitmq_user_permissions {[
150 configure_permission => '.*',
151 write_permission => '.*',
152 read_permission => '.*',
153 provider => 'rabbitmqctl',
156 # pre-install swift here so we can build rings
159 $cinder_enable_rbd_backend = hiera('cinder_enable_rbd_backend', false)
160 $enable_ceph = $cinder_enable_rbd_backend
163 class { 'ceph::profile::params':
164 mon_initial_members => downcase(hiera('ceph_mon_initial_members'))
166 include ::ceph::profile::mon
169 if $cinder_enable_rbd_backend {
170 ceph::key { 'client.openstack' :
171 secret => hiera('ceph::profile::params::mon_key'),
172 cap_mon => hiera('ceph_openstack_default_cap_mon'),
173 cap_osd => hiera('ceph_openstack_default_cap_osd'),
181 if hiera('step') >= 3 {
185 #TODO: need a cleanup-keystone-tokens.sh solution here
187 'ec2/driver': value => 'keystone.contrib.ec2.backends.sql.Ec2';
189 file { [ '/etc/keystone/ssl', '/etc/keystone/ssl/certs', '/etc/keystone/ssl/private' ]:
190 ensure => 'directory',
193 require => Package['keystone'],
195 file { '/etc/keystone/ssl/certs/signing_cert.pem':
196 content => hiera('keystone_signing_certificate'),
199 notify => Service['keystone'],
200 require => File['/etc/keystone/ssl/certs'],
202 file { '/etc/keystone/ssl/private/signing_key.pem':
203 content => hiera('keystone_signing_key'),
206 notify => Service['keystone'],
207 require => File['/etc/keystone/ssl/private'],
209 file { '/etc/keystone/ssl/certs/ca.pem':
210 content => hiera('keystone_ca_certificate'),
213 notify => Service['keystone'],
214 require => File['/etc/keystone/ssl/certs'],
217 # TODO: notifications, scrubber, etc.
218 include ::glance::api
219 include ::glance::registry
220 include ::glance::backend::swift
223 rabbit_hosts => [hiera('controller_virtual_ip')],
224 glance_api_servers => join([hiera('glance_protocol'), '://', hiera('controller_virtual_ip'), ':', hiera('glance_port')]),
229 include ::nova::conductor
230 include ::nova::consoleauth
231 include ::nova::network::neutron
232 include ::nova::vncproxy
233 include ::nova::scheduler
236 rabbit_hosts => [hiera('controller_virtual_ip')],
239 include ::neutron::server
240 include ::neutron::agents::dhcp
241 include ::neutron::agents::l3
243 file { '/etc/neutron/dnsmasq-neutron.conf':
244 content => hiera('neutron_dnsmasq_options'),
247 notify => Service['neutron-dhcp-service'],
248 require => Package['neutron'],
251 class { 'neutron::plugins::ml2':
252 flat_networks => split(hiera('neutron_flat_networks'), ','),
253 tenant_network_types => [hiera('neutron_tenant_network_type')],
254 type_drivers => [hiera('neutron_tenant_network_type')],
257 class { 'neutron::agents::ml2::ovs':
258 bridge_mappings => split(hiera('neutron_bridge_mappings'), ','),
259 tunnel_types => split(hiera('neutron_tunnel_types'), ','),
262 class { 'neutron::agents::metadata':
263 auth_url => join(['http://', hiera('controller_virtual_ip'), ':35357/v2.0']),
266 Service['neutron-server'] -> Service['neutron-dhcp-service']
267 Service['neutron-server'] -> Service['neutron-l3']
268 Service['neutron-server'] -> Service['neutron-ovs-agent-service']
269 Service['neutron-server'] -> Service['neutron-metadata']
272 rabbit_hosts => [hiera('controller_virtual_ip')],
275 include ::cinder::api
276 include ::cinder::glance
277 include ::cinder::scheduler
278 include ::cinder::volume
279 class {'cinder::setup_test_volume':
280 size => join([hiera('cinder_lvm_loop_device_size'), 'M']),
283 $cinder_enable_iscsi = hiera('cinder_enable_iscsi_backend', true)
284 if $cinder_enable_iscsi {
285 $cinder_iscsi_backend = 'tripleo_iscsi'
287 cinder::backend::iscsi { $cinder_iscsi_backend :
288 iscsi_ip_address => hiera('cinder_iscsi_ip_address'),
289 iscsi_helper => hiera('cinder_iscsi_helper'),
296 pg_num => hiera('ceph::profile::params::osd_pool_default_pg_num'),
297 pgp_num => hiera('ceph::profile::params::osd_pool_default_pgp_num'),
298 size => hiera('ceph::profile::params::osd_pool_default_size'),
301 $ceph_pools = hiera('ceph_pools')
302 ceph::pool { $ceph_pools : }
305 if $cinder_enable_rbd_backend {
306 $cinder_rbd_backend = 'tripleo_ceph'
309 "${cinder_rbd_backend}/host": value => 'hostgroup';
312 cinder::backend::rbd { $cinder_rbd_backend :
313 rbd_pool => 'volumes',
314 rbd_user => 'openstack',
315 rbd_secret_uuid => hiera('ceph::profile::params::fsid'),
316 require => Ceph::Pool['volumes'],
320 $cinder_enabled_backends = delete_undef_values([$cinder_iscsi_backend, $cinder_rbd_backend])
321 class { '::cinder::backends' :
322 enabled_backends => $cinder_enabled_backends,
327 include ::swift::proxy
328 include ::swift::proxy::proxy_logging
329 include ::swift::proxy::healthcheck
330 include ::swift::proxy::cache
331 include ::swift::proxy::keystone
332 include ::swift::proxy::authtoken
333 include ::swift::proxy::staticweb
334 include ::swift::proxy::ceilometer
335 include ::swift::proxy::ratelimit
336 include ::swift::proxy::catch_errors
337 include ::swift::proxy::tempurl
338 include ::swift::proxy::formpost
341 class {'swift::storage::all':
342 mount_check => str2bool(hiera('swift_mount_check'))
344 if(!defined(File['/srv/node'])) {
349 require => Package['openstack-swift'],
352 $swift_components = ['account', 'container', 'object']
353 swift::storage::filter::recon { $swift_components : }
354 swift::storage::filter::healthcheck { $swift_components : }
358 include ::ceilometer::api
359 include ::ceilometer::db
360 include ::ceilometer::agent::notification
361 include ::ceilometer::agent::central
362 include ::ceilometer::alarm::notifier
363 include ::ceilometer::alarm::evaluator
364 include ::ceilometer::expirer
365 include ::ceilometer::collector
366 class { 'ceilometer::agent::auth':
367 auth_url => join(['http://', hiera('controller_virtual_ip'), ':5000/v2.0']),
370 Cron <| title == 'ceilometer-expirer' |> { command => "sleep $((\$(od -A n -t d -N 3 /dev/urandom) % 86400)) && ${::ceilometer::params::expirer_command}" }
375 include ::heat::api_cfn
376 include ::heat::api_cloudwatch
377 include ::heat::engine
379 $snmpd_user = hiera('snmpd_readonly_user_name')
380 snmp::snmpv3_user { $snmpd_user:
382 authpass => hiera('snmpd_readonly_user_password'),
385 agentaddress => ['udp:161','udp6:[::1]:161'],
386 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' ],