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
17 include ::tripleo::firewall
19 $enable_load_balancer = hiera('enable_load_balancer', true)
21 if hiera('step') >= 1 {
23 create_resources(kmod::load, hiera('kernel_modules'), {})
24 create_resources(sysctl::value, hiera('sysctl_settings'), {})
25 Exec <| tag == 'kmod::load' |> -> Sysctl <| |>
29 if hiera('step') >= 2 {
34 if downcase(hiera('ceilometer_backend')) == 'mongodb' {
35 # NOTE(gfidente): We need to pass the list of IPv6 addresses *with* port and
36 # without the brackets as 'members' argument for the 'mongodb_replset'
38 if str2bool(hiera('mongodb::server::ipv6', false)) {
39 $mongo_node_ips_with_port_prefixed = prefix(hiera('mongo_node_ips'), '[')
40 $mongo_node_ips_with_port = suffix($mongo_node_ips_with_port_prefixed, ']:27017')
41 $mongo_node_ips_with_port_nobr = suffix(hiera('mongo_node_ips'), ':27017')
43 $mongo_node_ips_with_port = suffix(hiera('mongo_node_ips'), ':27017')
44 $mongo_node_ips_with_port_nobr = suffix(hiera('mongo_node_ips'), ':27017')
46 $mongo_node_string = join($mongo_node_ips_with_port, ',')
48 $mongodb_replset = hiera('mongodb::server::replset')
49 $ceilometer_mongodb_conn_string = "mongodb://${mongo_node_string}/ceilometer?replicaSet=${mongodb_replset}"
52 if str2bool(hiera('enable_galera', true)) {
53 $mysql_config_file = '/etc/my.cnf.d/galera.cnf'
55 $mysql_config_file = '/etc/my.cnf.d/server.cnf'
58 # FIXME: due to https://bugzilla.redhat.com/show_bug.cgi?id=1298671 we
59 # set bind-address to a hostname instead of an ip address; to move Mysql
60 # from internal_api on another network we'll have to customize both
61 # MysqlNetwork and ControllerHostnameResolveNetwork in ServiceNetMap
62 class { '::mysql::server':
63 config_file => $mysql_config_file,
66 'bind-address' => $::hostname,
67 'max_connections' => hiera('mysql_max_connections'),
68 'open_files_limit' => '-1',
71 remove_default_accounts => true,
74 # FIXME: this should only occur on the bootstrap host (ditto for db syncs)
75 # Create all the database schemas
76 include ::nova::db::mysql
77 include ::nova::db::mysql_api
78 if downcase(hiera('gnocchi_indexer_backend')) == 'mysql' {
79 include ::gnocchi::db::mysql
81 if downcase(hiera('ceilometer_backend')) == 'mysql' {
82 include ::ceilometer::db::mysql
83 include ::aodh::db::mysql
86 $enable_ceph = hiera('ceph_storage_count', 0) > 0 or hiera('enable_ceph_storage', false)
89 $mon_initial_members = downcase(hiera('ceph_mon_initial_members'))
90 if str2bool(hiera('ceph_ipv6', false)) {
91 $mon_host = hiera('ceph_mon_host_v6')
93 $mon_host = hiera('ceph_mon_host')
95 class { '::ceph::profile::params':
96 mon_initial_members => $mon_initial_members,
97 mon_host => $mon_host,
100 include ::ceph::profile::mon
103 if str2bool(hiera('enable_ceph_storage', false)) {
104 if str2bool(hiera('ceph_osd_selinux_permissive', true)) {
105 exec { 'set selinux to permissive on boot':
106 command => "sed -ie 's/^SELINUX=.*/SELINUX=permissive/' /etc/selinux/config",
107 onlyif => "test -f /etc/selinux/config && ! grep '^SELINUX=permissive' /etc/selinux/config",
108 path => ['/usr/bin', '/usr/sbin'],
111 exec { 'set selinux to permissive':
112 command => 'setenforce 0',
113 onlyif => "which setenforce && getenforce | grep -i 'enforcing'",
114 path => ['/usr/bin', '/usr/sbin'],
115 } -> Class['ceph::profile::osd']
119 include ::ceph::profile::osd
122 if str2bool(hiera('enable_external_ceph', false)) {
123 if str2bool(hiera('ceph_ipv6', false)) {
124 $mon_host = hiera('ceph_mon_host_v6')
126 $mon_host = hiera('ceph_mon_host')
128 class { '::ceph::profile::params':
129 mon_host => $mon_host,
132 include ::ceph::profile::client
137 if hiera('step') >= 4 {
139 $nova_ipv6 = hiera('nova::use_ipv6', false)
141 $memcached_servers = suffix(hiera('memcache_node_ips_v6'), ':11211')
143 $memcached_servers = suffix(hiera('memcache_node_ips'), ':11211')
147 memcached_servers => $memcached_servers
149 include ::nova::config
150 include ::nova::network::neutron
152 if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
154 # TODO(devvesa) provide non-controller ips for these services
155 $zookeeper_node_ips = hiera('neutron_api_node_ips')
156 $cassandra_node_ips = hiera('neutron_api_node_ips')
158 # Run zookeeper in the controller if configured
159 if hiera('enable_zookeeper_on_controller') {
160 class {'::tripleo::cluster::zookeeper':
161 zookeeper_server_ips => $zookeeper_node_ips,
162 # TODO: create a 'bind' hiera key for zookeeper
163 zookeeper_client_ip => hiera('neutron::bind_host'),
164 zookeeper_hostnames => hiera('controller_node_names')
168 # Run cassandra in the controller if configured
169 if hiera('enable_cassandra_on_controller') {
170 class {'::tripleo::cluster::cassandra':
171 cassandra_servers => $cassandra_node_ips,
172 # TODO: create a 'bind' hiera key for cassandra
173 cassandra_ip => hiera('neutron::bind_host'),
177 class {'::tripleo::network::midonet::agent':
178 zookeeper_servers => $zookeeper_node_ips,
179 cassandra_seeds => $cassandra_node_ips
182 class {'::tripleo::network::midonet::api':
183 zookeeper_servers => $zookeeper_node_ips,
184 vip => hiera('public_virtual_ip'),
185 keystone_ip => hiera('public_virtual_ip'),
186 keystone_admin_token => hiera('keystone::admin_token'),
187 # TODO: create a 'bind' hiera key for api
188 bind_address => hiera('neutron::bind_host'),
189 admin_password => hiera('admin_password')
192 # TODO: find a way to get an empty list from hiera
193 # TODO: when doing the composable midonet plugin, don't forget to
194 # set service_plugins to an empty array in Hiera.
196 service_plugins => []
201 # If the value of core plugin is set to 'nuage' or'opencontrail'
202 # include nuage or opencontrail core plugins
203 # else use the default value of 'ml2'
204 if hiera('neutron::core_plugin') == 'neutron.plugins.nuage.plugin.NuagePlugin' {
205 include ::neutron::plugins::nuage
206 } elsif hiera('neutron::core_plugin') == 'neutron_plugin_contrail.plugins.opencontrail.contrail_plugin.NeutronPluginContrailCoreV2' {
207 include ::neutron::plugins::opencontrail
210 # If the value of core plugin is set to 'midonet',
211 # skip all the ML2 configuration
212 if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
214 class {'::neutron::plugins::midonet':
215 midonet_api_ip => hiera('public_virtual_ip'),
216 keystone_tenant => hiera('neutron::server::auth_tenant'),
217 keystone_password => hiera('neutron::server::password')
221 Service['neutron-server'] -> Service['neutron-metadata']
226 $ceph_pools = hiera('ceph_pools')
227 ceph::pool { $ceph_pools :
228 pg_num => hiera('ceph::profile::params::osd_pool_default_pg_num'),
229 pgp_num => hiera('ceph::profile::params::osd_pool_default_pgp_num'),
230 size => hiera('ceph::profile::params::osd_pool_default_size'),
235 if str2bool(hiera('enable_swift_storage', true)) {
236 class { '::swift::storage::all':
237 mount_check => str2bool(hiera('swift_mount_check')),
239 if(!defined(File['/srv/node'])) {
244 require => Package['openstack-swift'],
247 $swift_components = ['account', 'container', 'object']
248 swift::storage::filter::recon { $swift_components : }
249 swift::storage::filter::healthcheck { $swift_components : }
253 $ceilometer_backend = downcase(hiera('ceilometer_backend'))
254 case $ceilometer_backend {
256 $ceilometer_database_connection = hiera('ceilometer_mysql_conn_string')
259 $ceilometer_database_connection = $ceilometer_mongodb_conn_string
263 include ::ceilometer::config
264 include ::ceilometer::api
265 include ::ceilometer::agent::notification
266 include ::ceilometer::agent::central
267 include ::ceilometer::expirer
268 include ::ceilometer::collector
269 include ::ceilometer::agent::auth
270 include ::ceilometer::dispatcher::gnocchi
271 class { '::ceilometer::db' :
272 database_connection => $ceilometer_database_connection,
275 Cron <| title == 'ceilometer-expirer' |> { command => "sleep $((\$(od -A n -t d -N 3 /dev/urandom) % 86400)) && ${::ceilometer::params::expirer_command}" }
279 database_connection => $ceilometer_database_connection,
281 include ::aodh::db::sync
282 # To manage the upgrade:
283 Exec['ceilometer-dbsync'] -> Exec['aodh-db-sync']
286 include ::aodh::wsgi::apache
287 include ::aodh::evaluator
288 include ::aodh::notifier
289 include ::aodh::listener
290 include ::aodh::client
293 include ::apache::mod::remoteip
294 if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') {
295 $_profile_support = 'cisco'
297 $_profile_support = 'None'
299 $neutron_options = {'profile_support' => $_profile_support }
301 $memcached_ipv6 = hiera('memcached_ipv6', false)
303 $horizon_memcached_servers = hiera('memcache_node_ips_v6', '[::1]')
305 $horizon_memcached_servers = hiera('memcache_node_ips', '127.0.0.1')
309 cache_server_ip => $horizon_memcached_servers,
310 neutron_options => $neutron_options,
314 $gnocchi_database_connection = hiera('gnocchi_mysql_conn_string')
316 database_connection => $gnocchi_database_connection,
318 include ::gnocchi::api
319 include ::gnocchi::wsgi::apache
320 include ::gnocchi::client
321 include ::gnocchi::db::sync
322 include ::gnocchi::storage
323 include ::gnocchi::metricd
324 include ::gnocchi::statsd
325 $gnocchi_backend = downcase(hiera('gnocchi_backend', 'swift'))
326 case $gnocchi_backend {
327 'swift': { include ::gnocchi::storage::swift }
328 'file': { include ::gnocchi::storage::file }
329 'rbd': { include ::gnocchi::storage::ceph }
330 default: { fail('Unrecognized gnocchi_backend parameter.') }
333 $snmpd_user = hiera('snmpd_readonly_user_name')
334 snmp::snmpv3_user { $snmpd_user:
336 authpass => hiera('snmpd_readonly_user_password'),
339 agentaddress => ['udp:161','udp6:[::1]:161'],
340 snmpd_config => [ join(['createUser ', hiera('snmpd_readonly_user_name'), ' MD5 "', hiera('snmpd_readonly_user_password'), '"']), join(['rouser ', hiera('snmpd_readonly_user_name')]), 'proc cron', 'includeAllDisks 10%', 'master agentx', 'trapsink localhost public', 'iquerySecName internalUser', 'rouser internalUser', 'defaultMonitors yes', 'linkUpDownNotifications yes' ],
343 hiera_include('controller_classes')
347 if hiera('step') >= 5 {
348 $nova_enable_db_purge = hiera('nova_enable_db_purge', true)
350 if $nova_enable_db_purge {
351 include ::nova::cron::archive_deleted_rows
355 $package_manifest_name = join(['/var/lib/tripleo/installed-packages/overcloud_controller', hiera('step')])
356 package_manifest{$package_manifest_name: ensure => present}