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 {
32 if downcase(hiera('ceilometer_backend')) == 'mongodb' {
33 # NOTE(gfidente): We need to pass the list of IPv6 addresses *with* port and
34 # without the brackets as 'members' argument for the 'mongodb_replset'
36 if str2bool(hiera('mongodb::server::ipv6', false)) {
37 $mongo_node_ips_with_port_prefixed = prefix(hiera('mongo_node_ips'), '[')
38 $mongo_node_ips_with_port = suffix($mongo_node_ips_with_port_prefixed, ']:27017')
39 $mongo_node_ips_with_port_nobr = suffix(hiera('mongo_node_ips'), ':27017')
41 $mongo_node_ips_with_port = suffix(hiera('mongo_node_ips'), ':27017')
42 $mongo_node_ips_with_port_nobr = suffix(hiera('mongo_node_ips'), ':27017')
44 $mongo_node_string = join($mongo_node_ips_with_port, ',')
46 $mongodb_replset = hiera('mongodb::server::replset')
47 $ceilometer_mongodb_conn_string = "mongodb://${mongo_node_string}/ceilometer?replicaSet=${mongodb_replset}"
50 if str2bool(hiera('enable_galera', true)) {
51 $mysql_config_file = '/etc/my.cnf.d/galera.cnf'
53 $mysql_config_file = '/etc/my.cnf.d/server.cnf'
56 # FIXME: due to https://bugzilla.redhat.com/show_bug.cgi?id=1298671 we
57 # set bind-address to a hostname instead of an ip address; to move Mysql
58 # from internal_api on another network we'll have to customize both
59 # MysqlNetwork and ControllerHostnameResolveNetwork in ServiceNetMap
60 class { '::mysql::server':
61 config_file => $mysql_config_file,
64 'bind-address' => $::hostname,
65 'max_connections' => hiera('mysql_max_connections'),
66 'open_files_limit' => '-1',
69 remove_default_accounts => true,
72 # FIXME: this should only occur on the bootstrap host (ditto for db syncs)
73 # Create all the database schemas
74 if downcase(hiera('gnocchi_indexer_backend')) == 'mysql' {
75 include ::gnocchi::db::mysql
77 if downcase(hiera('ceilometer_backend')) == 'mysql' {
78 include ::ceilometer::db::mysql
80 include ::aodh::db::mysql
84 if hiera('step') >= 4 {
86 $nova_ipv6 = hiera('nova::use_ipv6', false)
88 $memcached_servers = suffix(hiera('memcache_node_ips_v6'), ':11211')
90 $memcached_servers = suffix(hiera('memcache_node_ips'), ':11211')
94 memcached_servers => $memcached_servers
96 include ::nova::config
98 if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
100 # TODO(devvesa) provide non-controller ips for these services
101 $zookeeper_node_ips = hiera('neutron_api_node_ips')
102 $cassandra_node_ips = hiera('neutron_api_node_ips')
104 # Run zookeeper in the controller if configured
105 if hiera('enable_zookeeper_on_controller') {
106 class {'::tripleo::cluster::zookeeper':
107 zookeeper_server_ips => $zookeeper_node_ips,
108 # TODO: create a 'bind' hiera key for zookeeper
109 zookeeper_client_ip => hiera('neutron::bind_host'),
110 zookeeper_hostnames => hiera('controller_node_names')
114 # Run cassandra in the controller if configured
115 if hiera('enable_cassandra_on_controller') {
116 class {'::tripleo::cluster::cassandra':
117 cassandra_servers => $cassandra_node_ips,
118 # TODO: create a 'bind' hiera key for cassandra
119 cassandra_ip => hiera('neutron::bind_host'),
123 class {'::tripleo::network::midonet::agent':
124 zookeeper_servers => $zookeeper_node_ips,
125 cassandra_seeds => $cassandra_node_ips
128 class {'::tripleo::network::midonet::api':
129 zookeeper_servers => $zookeeper_node_ips,
130 vip => hiera('public_virtual_ip'),
131 keystone_ip => hiera('public_virtual_ip'),
132 keystone_admin_token => hiera('keystone::admin_token'),
133 # TODO: create a 'bind' hiera key for api
134 bind_address => hiera('neutron::bind_host'),
135 admin_password => hiera('admin_password')
138 # TODO: find a way to get an empty list from hiera
139 # TODO: when doing the composable midonet plugin, don't forget to
140 # set service_plugins to an empty array in Hiera.
142 service_plugins => []
147 # If the value of core plugin is set to 'midonet',
148 # skip all the ML2 configuration
149 if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
151 class {'::neutron::plugins::midonet':
152 midonet_api_ip => hiera('public_virtual_ip'),
153 keystone_tenant => hiera('neutron::server::auth_tenant'),
154 keystone_password => hiera('neutron::server::password')
159 $ceilometer_backend = downcase(hiera('ceilometer_backend'))
160 case $ceilometer_backend {
162 $ceilometer_database_connection = hiera('ceilometer_mysql_conn_string')
165 $ceilometer_database_connection = $ceilometer_mongodb_conn_string
169 include ::ceilometer::config
170 include ::ceilometer::api
171 include ::ceilometer::agent::notification
172 include ::ceilometer::agent::central
173 include ::ceilometer::expirer
174 include ::ceilometer::collector
175 include ::ceilometer::agent::auth
176 include ::ceilometer::dispatcher::gnocchi
177 class { '::ceilometer::db' :
178 database_connection => $ceilometer_database_connection,
181 Cron <| title == 'ceilometer-expirer' |> { command => "sleep $((\$(od -A n -t d -N 3 /dev/urandom) % 86400)) && ${::ceilometer::params::expirer_command}" }
185 database_connection => hiera('aodh_mysql_conn_string'),
187 include ::aodh::db::sync
190 include ::aodh::wsgi::apache
191 include ::aodh::evaluator
192 include ::aodh::notifier
193 include ::aodh::listener
194 include ::aodh::client
197 include ::apache::mod::remoteip
198 if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') {
199 $_profile_support = 'cisco'
201 $_profile_support = 'None'
203 $neutron_options = merge({'profile_support' => $_profile_support },hiera('horizon::neutron_options',undef))
205 $memcached_ipv6 = hiera('memcached_ipv6', false)
207 $horizon_memcached_servers = hiera('memcache_node_ips_v6', '[::1]')
209 $horizon_memcached_servers = hiera('memcache_node_ips', '127.0.0.1')
213 cache_server_ip => $horizon_memcached_servers,
214 neutron_options => $neutron_options,
218 $gnocchi_database_connection = hiera('gnocchi_mysql_conn_string')
220 database_connection => $gnocchi_database_connection,
222 include ::gnocchi::api
223 include ::gnocchi::wsgi::apache
224 include ::gnocchi::client
225 include ::gnocchi::db::sync
226 include ::gnocchi::storage
227 include ::gnocchi::metricd
228 include ::gnocchi::statsd
229 $gnocchi_backend = downcase(hiera('gnocchi_backend', 'swift'))
230 case $gnocchi_backend {
231 'swift': { include ::gnocchi::storage::swift }
232 'file': { include ::gnocchi::storage::file }
233 'rbd': { include ::gnocchi::storage::ceph }
234 default: { fail('Unrecognized gnocchi_backend parameter.') }
237 hiera_include('controller_classes')
241 if hiera('step') >= 5 {
242 $nova_enable_db_purge = hiera('nova_enable_db_purge', true)
244 if $nova_enable_db_purge {
245 include ::nova::cron::archive_deleted_rows
249 $package_manifest_name = join(['/var/lib/tripleo/installed-packages/overcloud_controller', hiera('step')])
250 package_manifest{$package_manifest_name: ensure => present}