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 {
33 if str2bool(hiera('enable_galera', true)) {
34 $mysql_config_file = '/etc/my.cnf.d/galera.cnf'
36 $mysql_config_file = '/etc/my.cnf.d/server.cnf'
39 # FIXME: due to https://bugzilla.redhat.com/show_bug.cgi?id=1298671 we
40 # set bind-address to a hostname instead of an ip address; to move Mysql
41 # from internal_api on another network we'll have to customize both
42 # MysqlNetwork and ControllerHostnameResolveNetwork in ServiceNetMap
43 class { '::mysql::server':
44 config_file => $mysql_config_file,
47 'bind-address' => $::hostname,
48 'max_connections' => hiera('mysql_max_connections'),
49 'open_files_limit' => '-1',
52 remove_default_accounts => true,
55 # FIXME: this should only occur on the bootstrap host (ditto for db syncs)
56 # Create all the database schemas
57 if downcase(hiera('gnocchi_indexer_backend')) == 'mysql' {
58 include ::gnocchi::db::mysql
60 include ::aodh::db::mysql
62 $enable_ceph = hiera('ceph_storage_count', 0) > 0 or hiera('enable_ceph_storage', false)
65 $mon_initial_members = downcase(hiera('ceph_mon_initial_members'))
66 if str2bool(hiera('ceph_ipv6', false)) {
67 $mon_host = hiera('ceph_mon_host_v6')
69 $mon_host = hiera('ceph_mon_host')
71 class { '::ceph::profile::params':
72 mon_initial_members => $mon_initial_members,
73 mon_host => $mon_host,
76 include ::ceph::profile::mon
79 if str2bool(hiera('enable_ceph_storage', false)) {
80 if str2bool(hiera('ceph_osd_selinux_permissive', true)) {
81 exec { 'set selinux to permissive on boot':
82 command => "sed -ie 's/^SELINUX=.*/SELINUX=permissive/' /etc/selinux/config",
83 onlyif => "test -f /etc/selinux/config && ! grep '^SELINUX=permissive' /etc/selinux/config",
84 path => ['/usr/bin', '/usr/sbin'],
87 exec { 'set selinux to permissive':
88 command => 'setenforce 0',
89 onlyif => "which setenforce && getenforce | grep -i 'enforcing'",
90 path => ['/usr/bin', '/usr/sbin'],
91 } -> Class['ceph::profile::osd']
95 include ::ceph::profile::osd
98 if str2bool(hiera('enable_external_ceph', false)) {
99 if str2bool(hiera('ceph_ipv6', false)) {
100 $mon_host = hiera('ceph_mon_host_v6')
102 $mon_host = hiera('ceph_mon_host')
104 class { '::ceph::profile::params':
105 mon_host => $mon_host,
108 include ::ceph::profile::client
113 if hiera('step') >= 4 {
115 $nova_ipv6 = hiera('nova::use_ipv6', false)
117 $memcached_servers = suffix(hiera('memcache_node_ips_v6'), ':11211')
119 $memcached_servers = suffix(hiera('memcache_node_ips'), ':11211')
123 memcached_servers => $memcached_servers
125 include ::nova::config
127 if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
129 # TODO(devvesa) provide non-controller ips for these services
130 $zookeeper_node_ips = hiera('neutron_api_node_ips')
131 $cassandra_node_ips = hiera('neutron_api_node_ips')
133 # Run zookeeper in the controller if configured
134 if hiera('enable_zookeeper_on_controller') {
135 class {'::tripleo::cluster::zookeeper':
136 zookeeper_server_ips => $zookeeper_node_ips,
137 # TODO: create a 'bind' hiera key for zookeeper
138 zookeeper_client_ip => hiera('neutron::bind_host'),
139 zookeeper_hostnames => hiera('controller_node_names')
143 # Run cassandra in the controller if configured
144 if hiera('enable_cassandra_on_controller') {
145 class {'::tripleo::cluster::cassandra':
146 cassandra_servers => $cassandra_node_ips,
147 # TODO: create a 'bind' hiera key for cassandra
148 cassandra_ip => hiera('neutron::bind_host'),
152 class {'::tripleo::network::midonet::agent':
153 zookeeper_servers => $zookeeper_node_ips,
154 cassandra_seeds => $cassandra_node_ips
157 class {'::tripleo::network::midonet::api':
158 zookeeper_servers => $zookeeper_node_ips,
159 vip => hiera('public_virtual_ip'),
160 keystone_ip => hiera('public_virtual_ip'),
161 keystone_admin_token => hiera('keystone::admin_token'),
162 # TODO: create a 'bind' hiera key for api
163 bind_address => hiera('neutron::bind_host'),
164 admin_password => hiera('admin_password')
167 # TODO: find a way to get an empty list from hiera
168 # TODO: when doing the composable midonet plugin, don't forget to
169 # set service_plugins to an empty array in Hiera.
171 service_plugins => []
176 # If the value of core plugin is set to 'midonet',
177 # skip all the ML2 configuration
178 if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
180 class {'::neutron::plugins::midonet':
181 midonet_api_ip => hiera('public_virtual_ip'),
182 keystone_tenant => hiera('neutron::server::auth_tenant'),
183 keystone_password => hiera('neutron::server::password')
188 $ceph_pools = hiera('ceph_pools')
189 ceph::pool { $ceph_pools :
190 pg_num => hiera('ceph::profile::params::osd_pool_default_pg_num'),
191 pgp_num => hiera('ceph::profile::params::osd_pool_default_pgp_num'),
192 size => hiera('ceph::profile::params::osd_pool_default_size'),
197 if str2bool(hiera('enable_swift_storage', true)) {
198 class { '::swift::storage::all':
199 mount_check => str2bool(hiera('swift_mount_check')),
201 if(!defined(File['/srv/node'])) {
206 require => Package['openstack-swift'],
209 $swift_components = ['account', 'container', 'object']
210 swift::storage::filter::recon { $swift_components : }
211 swift::storage::filter::healthcheck { $swift_components : }
216 database_connection => hiera('aodh_mysql_conn_string'),
218 include ::aodh::db::sync
221 include ::aodh::wsgi::apache
222 include ::aodh::evaluator
223 include ::aodh::notifier
224 include ::aodh::listener
225 include ::aodh::client
228 include ::apache::mod::remoteip
229 if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') {
230 $_profile_support = 'cisco'
232 $_profile_support = 'None'
234 $neutron_options = merge({'profile_support' => $_profile_support },hiera('horizon::neutron_options',undef))
236 $memcached_ipv6 = hiera('memcached_ipv6', false)
238 $horizon_memcached_servers = hiera('memcache_node_ips_v6', '[::1]')
240 $horizon_memcached_servers = hiera('memcache_node_ips', '127.0.0.1')
244 cache_server_ip => $horizon_memcached_servers,
245 neutron_options => $neutron_options,
249 $gnocchi_database_connection = hiera('gnocchi_mysql_conn_string')
251 database_connection => $gnocchi_database_connection,
253 include ::gnocchi::api
254 include ::gnocchi::wsgi::apache
255 include ::gnocchi::client
256 include ::gnocchi::db::sync
257 include ::gnocchi::storage
258 include ::gnocchi::metricd
259 include ::gnocchi::statsd
260 $gnocchi_backend = downcase(hiera('gnocchi_backend', 'swift'))
261 case $gnocchi_backend {
262 'swift': { include ::gnocchi::storage::swift }
263 'file': { include ::gnocchi::storage::file }
264 'rbd': { include ::gnocchi::storage::ceph }
265 default: { fail('Unrecognized gnocchi_backend parameter.') }
268 $snmpd_user = hiera('snmpd_readonly_user_name')
269 snmp::snmpv3_user { $snmpd_user:
271 authpass => hiera('snmpd_readonly_user_password'),
274 agentaddress => ['udp:161','udp6:[::1]:161'],
275 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' ],
278 hiera_include('controller_classes')
282 if hiera('step') >= 5 {
283 $nova_enable_db_purge = hiera('nova_enable_db_purge', true)
285 if $nova_enable_db_purge {
286 include ::nova::cron::archive_deleted_rows
290 $package_manifest_name = join(['/var/lib/tripleo/installed-packages/overcloud_controller', hiera('step')])
291 package_manifest{$package_manifest_name: ensure => present}