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 {
31 if count(hiera('ntp::servers')) > 0 {
38 if downcase(hiera('ceilometer_backend')) == 'mongodb' {
39 include ::mongodb::globals
40 include ::mongodb::client
41 include ::mongodb::server
42 # NOTE(gfidente): We need to pass the list of IPv6 addresses *with* port and
43 # without the brackets as 'members' argument for the 'mongodb_replset'
45 if str2bool(hiera('mongodb::server::ipv6', false)) {
46 $mongo_node_ips_with_port_prefixed = prefix(hiera('mongo_node_ips'), '[')
47 $mongo_node_ips_with_port = suffix($mongo_node_ips_with_port_prefixed, ']:27017')
48 $mongo_node_ips_with_port_nobr = suffix(hiera('mongo_node_ips'), ':27017')
50 $mongo_node_ips_with_port = suffix(hiera('mongo_node_ips'), ':27017')
51 $mongo_node_ips_with_port_nobr = suffix(hiera('mongo_node_ips'), ':27017')
53 $mongo_node_string = join($mongo_node_ips_with_port, ',')
55 $mongodb_replset = hiera('mongodb::server::replset')
56 $ceilometer_mongodb_conn_string = "mongodb://${mongo_node_string}/ceilometer?replicaSet=${mongodb_replset}"
57 if downcase(hiera('bootstrap_nodeid')) == $::hostname {
58 mongodb_replset { $mongodb_replset :
59 members => $mongo_node_ips_with_port_nobr,
64 if str2bool(hiera('enable_galera', true)) {
65 $mysql_config_file = '/etc/my.cnf.d/galera.cnf'
67 $mysql_config_file = '/etc/my.cnf.d/server.cnf'
70 # FIXME: due to https://bugzilla.redhat.com/show_bug.cgi?id=1298671 we
71 # set bind-address to a hostname instead of an ip address; to move Mysql
72 # from internal_api on another network we'll have to customize both
73 # MysqlNetwork and ControllerHostnameResolveNetwork in ServiceNetMap
74 class { '::mysql::server':
75 config_file => $mysql_config_file,
78 'bind-address' => $::hostname,
79 'max_connections' => hiera('mysql_max_connections'),
80 'open_files_limit' => '-1',
83 remove_default_accounts => true,
86 # FIXME: this should only occur on the bootstrap host (ditto for db syncs)
87 # Create all the database schemas
88 include ::nova::db::mysql
89 include ::nova::db::mysql_api
90 include ::neutron::db::mysql
91 if downcase(hiera('gnocchi_indexer_backend')) == 'mysql' {
92 include ::gnocchi::db::mysql
94 if downcase(hiera('ceilometer_backend')) == 'mysql' {
95 include ::ceilometer::db::mysql
96 include ::aodh::db::mysql
99 $enable_ceph = hiera('ceph_storage_count', 0) > 0 or hiera('enable_ceph_storage', false)
102 $mon_initial_members = downcase(hiera('ceph_mon_initial_members'))
103 if str2bool(hiera('ceph_ipv6', false)) {
104 $mon_host = hiera('ceph_mon_host_v6')
106 $mon_host = hiera('ceph_mon_host')
108 class { '::ceph::profile::params':
109 mon_initial_members => $mon_initial_members,
110 mon_host => $mon_host,
113 include ::ceph::profile::mon
116 if str2bool(hiera('enable_ceph_storage', false)) {
117 if str2bool(hiera('ceph_osd_selinux_permissive', true)) {
118 exec { 'set selinux to permissive on boot':
119 command => "sed -ie 's/^SELINUX=.*/SELINUX=permissive/' /etc/selinux/config",
120 onlyif => "test -f /etc/selinux/config && ! grep '^SELINUX=permissive' /etc/selinux/config",
121 path => ['/usr/bin', '/usr/sbin'],
124 exec { 'set selinux to permissive':
125 command => 'setenforce 0',
126 onlyif => "which setenforce && getenforce | grep -i 'enforcing'",
127 path => ['/usr/bin', '/usr/sbin'],
128 } -> Class['ceph::profile::osd']
132 include ::ceph::profile::osd
135 if str2bool(hiera('enable_external_ceph', false)) {
136 if str2bool(hiera('ceph_ipv6', false)) {
137 $mon_host = hiera('ceph_mon_host_v6')
139 $mon_host = hiera('ceph_mon_host')
141 class { '::ceph::profile::params':
142 mon_host => $mon_host,
145 include ::ceph::profile::client
150 if hiera('step') >= 4 {
152 $nova_ipv6 = hiera('nova::use_ipv6', false)
154 $memcached_servers = suffix(hiera('memcache_node_ips_v6'), ':11211')
156 $memcached_servers = suffix(hiera('memcache_node_ips'), ':11211')
160 memcached_servers => $memcached_servers
162 include ::nova::config
165 include ::nova::consoleauth
166 include ::nova::network::neutron
167 include ::nova::vncproxy
168 include ::nova::scheduler
169 include ::nova::scheduler::filter
171 if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
173 # TODO(devvesa) provide non-controller ips for these services
174 $zookeeper_node_ips = hiera('neutron_api_node_ips')
175 $cassandra_node_ips = hiera('neutron_api_node_ips')
177 # Run zookeeper in the controller if configured
178 if hiera('enable_zookeeper_on_controller') {
179 class {'::tripleo::cluster::zookeeper':
180 zookeeper_server_ips => $zookeeper_node_ips,
181 # TODO: create a 'bind' hiera key for zookeeper
182 zookeeper_client_ip => hiera('neutron::bind_host'),
183 zookeeper_hostnames => hiera('controller_node_names')
187 # Run cassandra in the controller if configured
188 if hiera('enable_cassandra_on_controller') {
189 class {'::tripleo::cluster::cassandra':
190 cassandra_servers => $cassandra_node_ips,
191 # TODO: create a 'bind' hiera key for cassandra
192 cassandra_ip => hiera('neutron::bind_host'),
196 class {'::tripleo::network::midonet::agent':
197 zookeeper_servers => $zookeeper_node_ips,
198 cassandra_seeds => $cassandra_node_ips
201 class {'::tripleo::network::midonet::api':
202 zookeeper_servers => $zookeeper_node_ips,
203 vip => hiera('public_virtual_ip'),
204 keystone_ip => hiera('public_virtual_ip'),
205 keystone_admin_token => hiera('keystone::admin_token'),
206 # TODO: create a 'bind' hiera key for api
207 bind_address => hiera('neutron::bind_host'),
208 admin_password => hiera('admin_password')
211 # TODO: find a way to get an empty list from hiera
213 service_plugins => []
223 include ::neutron::config
224 include ::neutron::server
225 include ::neutron::server::notifications
227 # If the value of core plugin is set to 'nuage' or'opencontrail' or 'plumgrid',
228 # include nuage or opencontrail or plumgrid core plugins
229 # else use the default value of 'ml2'
230 if hiera('neutron::core_plugin') == 'neutron.plugins.nuage.plugin.NuagePlugin' {
231 include ::neutron::plugins::nuage
232 } elsif hiera('neutron::core_plugin') == 'neutron_plugin_contrail.plugins.opencontrail.contrail_plugin.NeutronPluginContrailCoreV2' {
233 include ::neutron::plugins::opencontrail
235 elsif hiera('neutron::core_plugin') == 'networking_plumgrid.neutron.plugins.plugin.NeutronPluginPLUMgridV2' {
236 class { '::neutron::plugins::plumgrid' :
237 connection => hiera('neutron::server::database_connection'),
238 controller_priv_host => hiera('keystone_admin_api_vip'),
239 admin_password => hiera('admin_password'),
240 metadata_proxy_shared_secret => hiera('nova::api::neutron_metadata_proxy_shared_secret'),
244 # If the value of core plugin is set to 'midonet',
245 # skip all the ML2 configuration
246 if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
248 class {'::neutron::plugins::midonet':
249 midonet_api_ip => hiera('public_virtual_ip'),
250 keystone_tenant => hiera('neutron::server::auth_tenant'),
251 keystone_password => hiera('neutron::server::password')
255 include ::neutron::plugins::ml2
256 include ::neutron::agents::ml2::ovs
258 if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') {
259 include ::neutron::plugins::ml2::cisco::nexus1000v
261 class { '::neutron::agents::n1kv_vem':
262 n1kv_source => hiera('n1kv_vem_source', undef),
263 n1kv_version => hiera('n1kv_vem_version', undef),
267 n1kv_source => hiera('n1kv_vsm_source', undef),
268 n1kv_version => hiera('n1kv_vsm_version', undef),
269 pacemaker_control => false,
273 if 'cisco_ucsm' in hiera('neutron::plugins::ml2::mechanism_drivers') {
274 include ::neutron::plugins::ml2::cisco::ucsm
276 if 'cisco_nexus' in hiera('neutron::plugins::ml2::mechanism_drivers') {
277 include ::neutron::plugins::ml2::cisco::nexus
278 include ::neutron::plugins::ml2::cisco::type_nexus_vxlan
281 if 'bsn_ml2' in hiera('neutron::plugins::ml2::mechanism_drivers') {
282 include ::neutron::plugins::ml2::bigswitch::restproxy
283 include ::neutron::agents::bigswitch
285 Service['neutron-server'] -> Service['neutron-ovs-agent-service']
288 Service['neutron-server'] -> Service['neutron-metadata']
292 $ceph_pools = hiera('ceph_pools')
293 ceph::pool { $ceph_pools :
294 pg_num => hiera('ceph::profile::params::osd_pool_default_pg_num'),
295 pgp_num => hiera('ceph::profile::params::osd_pool_default_pgp_num'),
296 size => hiera('ceph::profile::params::osd_pool_default_size'),
301 if str2bool(hiera('enable_swift_storage', true)) {
302 class { '::swift::storage::all':
303 mount_check => str2bool(hiera('swift_mount_check')),
305 if(!defined(File['/srv/node'])) {
310 require => Package['openstack-swift'],
313 $swift_components = ['account', 'container', 'object']
314 swift::storage::filter::recon { $swift_components : }
315 swift::storage::filter::healthcheck { $swift_components : }
319 $ceilometer_backend = downcase(hiera('ceilometer_backend'))
320 case $ceilometer_backend {
322 $ceilometer_database_connection = hiera('ceilometer_mysql_conn_string')
325 $ceilometer_database_connection = $ceilometer_mongodb_conn_string
329 include ::ceilometer::config
330 include ::ceilometer::api
331 include ::ceilometer::agent::notification
332 include ::ceilometer::agent::central
333 include ::ceilometer::expirer
334 include ::ceilometer::collector
335 include ::ceilometer::agent::auth
336 include ::ceilometer::dispatcher::gnocchi
337 class { '::ceilometer::db' :
338 database_connection => $ceilometer_database_connection,
341 Cron <| title == 'ceilometer-expirer' |> { command => "sleep $((\$(od -A n -t d -N 3 /dev/urandom) % 86400)) && ${::ceilometer::params::expirer_command}" }
345 database_connection => $ceilometer_database_connection,
347 include ::aodh::db::sync
348 # To manage the upgrade:
349 Exec['ceilometer-dbsync'] -> Exec['aodh-db-sync']
352 include ::aodh::wsgi::apache
353 include ::aodh::evaluator
354 include ::aodh::notifier
355 include ::aodh::listener
356 include ::aodh::client
359 include ::apache::mod::remoteip
360 if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') {
361 $_profile_support = 'cisco'
363 $_profile_support = 'None'
365 $neutron_options = {'profile_support' => $_profile_support }
367 $memcached_ipv6 = hiera('memcached_ipv6', false)
369 $horizon_memcached_servers = hiera('memcache_node_ips_v6', '[::1]')
371 $horizon_memcached_servers = hiera('memcache_node_ips', '127.0.0.1')
375 cache_server_ip => $horizon_memcached_servers,
376 neutron_options => $neutron_options,
380 $gnocchi_database_connection = hiera('gnocchi_mysql_conn_string')
382 database_connection => $gnocchi_database_connection,
384 include ::gnocchi::api
385 include ::gnocchi::wsgi::apache
386 include ::gnocchi::client
387 include ::gnocchi::db::sync
388 include ::gnocchi::storage
389 include ::gnocchi::metricd
390 include ::gnocchi::statsd
391 $gnocchi_backend = downcase(hiera('gnocchi_backend', 'swift'))
392 case $gnocchi_backend {
393 'swift': { include ::gnocchi::storage::swift }
394 'file': { include ::gnocchi::storage::file }
395 'rbd': { include ::gnocchi::storage::ceph }
396 default: { fail('Unrecognized gnocchi_backend parameter.') }
399 $snmpd_user = hiera('snmpd_readonly_user_name')
400 snmp::snmpv3_user { $snmpd_user:
402 authpass => hiera('snmpd_readonly_user_password'),
405 agentaddress => ['udp:161','udp6:[::1]:161'],
406 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' ],
409 hiera_include('controller_classes')
413 if hiera('step') >= 5 {
414 $nova_enable_db_purge = hiera('nova_enable_db_purge', true)
416 if $nova_enable_db_purge {
417 include ::nova::cron::archive_deleted_rows
421 $package_manifest_name = join(['/var/lib/tripleo/installed-packages/overcloud_controller', hiera('step')])
422 package_manifest{$package_manifest_name: ensure => present}