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') >= 2 {
24 if downcase(hiera('ceilometer_backend')) == 'mongodb' {
25 # NOTE(gfidente): We need to pass the list of IPv6 addresses *with* port and
26 # without the brackets as 'members' argument for the 'mongodb_replset'
28 if str2bool(hiera('mongodb::server::ipv6', false)) {
29 $mongo_node_ips_with_port_prefixed = prefix(hiera('mongo_node_ips'), '[')
30 $mongo_node_ips_with_port = suffix($mongo_node_ips_with_port_prefixed, ']:27017')
31 $mongo_node_ips_with_port_nobr = suffix(hiera('mongo_node_ips'), ':27017')
33 $mongo_node_ips_with_port = suffix(hiera('mongo_node_ips'), ':27017')
34 $mongo_node_ips_with_port_nobr = suffix(hiera('mongo_node_ips'), ':27017')
36 $mongo_node_string = join($mongo_node_ips_with_port, ',')
38 $mongodb_replset = hiera('mongodb::server::replset')
39 $ceilometer_mongodb_conn_string = "mongodb://${mongo_node_string}/ceilometer?replicaSet=${mongodb_replset}"
42 if str2bool(hiera('enable_galera', true)) {
43 $mysql_config_file = '/etc/my.cnf.d/galera.cnf'
45 $mysql_config_file = '/etc/my.cnf.d/server.cnf'
48 # FIXME: due to https://bugzilla.redhat.com/show_bug.cgi?id=1298671 we
49 # set bind-address to a hostname instead of an ip address; to move Mysql
50 # from internal_api on another network we'll have to customize both
51 # MysqlNetwork and ControllerHostnameResolveNetwork in ServiceNetMap
52 class { '::mysql::server':
53 config_file => $mysql_config_file,
56 'bind-address' => $::hostname,
57 'max_connections' => hiera('mysql_max_connections'),
58 'open_files_limit' => '-1',
61 remove_default_accounts => true,
64 # FIXME: this should only occur on the bootstrap host (ditto for db syncs)
65 # Create all the database schemas
66 if downcase(hiera('gnocchi_indexer_backend')) == 'mysql' {
67 include ::gnocchi::db::mysql
69 if downcase(hiera('ceilometer_backend')) == 'mysql' {
70 include ::ceilometer::db::mysql
72 include ::aodh::db::mysql
76 if hiera('step') >= 4 {
78 $nova_ipv6 = hiera('nova::use_ipv6', false)
80 $memcached_servers = suffix(hiera('memcache_node_ips_v6'), ':11211')
82 $memcached_servers = suffix(hiera('memcache_node_ips'), ':11211')
86 memcached_servers => $memcached_servers
88 include ::nova::config
90 if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
92 # TODO(devvesa) provide non-controller ips for these services
93 $zookeeper_node_ips = hiera('neutron_api_node_ips')
94 $cassandra_node_ips = hiera('neutron_api_node_ips')
96 # Run zookeeper in the controller if configured
97 if hiera('enable_zookeeper_on_controller') {
98 class {'::tripleo::cluster::zookeeper':
99 zookeeper_server_ips => $zookeeper_node_ips,
100 # TODO: create a 'bind' hiera key for zookeeper
101 zookeeper_client_ip => hiera('neutron::bind_host'),
102 zookeeper_hostnames => hiera('controller_node_names')
106 # Run cassandra in the controller if configured
107 if hiera('enable_cassandra_on_controller') {
108 class {'::tripleo::cluster::cassandra':
109 cassandra_servers => $cassandra_node_ips,
110 # TODO: create a 'bind' hiera key for cassandra
111 cassandra_ip => hiera('neutron::bind_host'),
115 class {'::tripleo::network::midonet::agent':
116 zookeeper_servers => $zookeeper_node_ips,
117 cassandra_seeds => $cassandra_node_ips
120 class {'::tripleo::network::midonet::api':
121 zookeeper_servers => $zookeeper_node_ips,
122 vip => hiera('public_virtual_ip'),
123 keystone_ip => hiera('public_virtual_ip'),
124 keystone_admin_token => hiera('keystone::admin_token'),
125 # TODO: create a 'bind' hiera key for api
126 bind_address => hiera('neutron::bind_host'),
127 admin_password => hiera('admin_password')
130 # TODO: find a way to get an empty list from hiera
131 # TODO: when doing the composable midonet plugin, don't forget to
132 # set service_plugins to an empty array in Hiera.
134 service_plugins => []
139 # If the value of core plugin is set to 'midonet',
140 # skip all the ML2 configuration
141 if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
143 class {'::neutron::plugins::midonet':
144 midonet_api_ip => hiera('public_virtual_ip'),
145 keystone_tenant => hiera('neutron::server::auth_tenant'),
146 keystone_password => hiera('neutron::server::password')
151 $ceilometer_backend = downcase(hiera('ceilometer_backend'))
152 case $ceilometer_backend {
154 $ceilometer_database_connection = hiera('ceilometer_mysql_conn_string')
157 $ceilometer_database_connection = $ceilometer_mongodb_conn_string
161 include ::ceilometer::config
162 include ::ceilometer::api
163 include ::ceilometer::agent::notification
164 include ::ceilometer::agent::central
165 include ::ceilometer::expirer
166 include ::ceilometer::collector
167 include ::ceilometer::agent::auth
168 include ::ceilometer::dispatcher::gnocchi
169 class { '::ceilometer::db' :
170 database_connection => $ceilometer_database_connection,
173 Cron <| title == 'ceilometer-expirer' |> { command => "sleep $((\$(od -A n -t d -N 3 /dev/urandom) % 86400)) && ${::ceilometer::params::expirer_command}" }
177 database_connection => hiera('aodh_mysql_conn_string'),
179 include ::aodh::db::sync
182 include ::aodh::wsgi::apache
183 include ::aodh::evaluator
184 include ::aodh::notifier
185 include ::aodh::listener
186 include ::aodh::client
189 include ::apache::mod::remoteip
190 if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') {
191 $_profile_support = 'cisco'
193 $_profile_support = 'None'
195 $neutron_options = merge({'profile_support' => $_profile_support },hiera('horizon::neutron_options',undef))
197 $memcached_ipv6 = hiera('memcached_ipv6', false)
199 $horizon_memcached_servers = hiera('memcache_node_ips_v6', '[::1]')
201 $horizon_memcached_servers = hiera('memcache_node_ips', '127.0.0.1')
205 cache_server_ip => $horizon_memcached_servers,
206 neutron_options => $neutron_options,
210 $gnocchi_database_connection = hiera('gnocchi_mysql_conn_string')
212 database_connection => $gnocchi_database_connection,
214 include ::gnocchi::api
215 include ::gnocchi::wsgi::apache
216 include ::gnocchi::client
217 include ::gnocchi::db::sync
218 include ::gnocchi::storage
219 include ::gnocchi::metricd
220 include ::gnocchi::statsd
221 $gnocchi_backend = downcase(hiera('gnocchi_backend', 'swift'))
222 case $gnocchi_backend {
223 'swift': { include ::gnocchi::storage::swift }
224 'file': { include ::gnocchi::storage::file }
225 'rbd': { include ::gnocchi::storage::ceph }
226 default: { fail('Unrecognized gnocchi_backend parameter.') }
229 hiera_include('controller_classes')
233 if hiera('step') >= 5 {
234 $nova_enable_db_purge = hiera('nova_enable_db_purge', true)
236 if $nova_enable_db_purge {
237 include ::nova::cron::archive_deleted_rows
241 $package_manifest_name = join(['/var/lib/tripleo/installed-packages/overcloud_controller', hiera('step')])
242 package_manifest{$package_manifest_name: ensure => present}