Merge "Use already Deployed/Installed servers"
[apex-tripleo-heat-templates.git] / puppet / manifests / overcloud_controller.pp
1 # Copyright 2014 Red Hat, Inc.
2 # All Rights Reserved.
3 #
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
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
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
14 # under the License.
15
16 include ::tripleo::packages
17 include ::tripleo::firewall
18
19 $enable_load_balancer = hiera('enable_load_balancer', true)
20
21 if hiera('step') >= 2 {
22   if str2bool(hiera('enable_galera', true)) {
23     $mysql_config_file = '/etc/my.cnf.d/galera.cnf'
24   } else {
25     $mysql_config_file = '/etc/my.cnf.d/server.cnf'
26   }
27   # TODO Galara
28   # FIXME: due to https://bugzilla.redhat.com/show_bug.cgi?id=1298671 we
29   # set bind-address to a hostname instead of an ip address; to move Mysql
30   # from internal_api on another network we'll have to customize both
31   # MysqlNetwork and ControllerHostnameResolveNetwork in ServiceNetMap
32   class { '::mysql::server':
33     config_file             => $mysql_config_file,
34     override_options        => {
35       'mysqld' => {
36         'bind-address'     => $::hostname,
37         'max_connections'  => hiera('mysql_max_connections'),
38         'open_files_limit' => '-1',
39       },
40     },
41     remove_default_accounts => true,
42   }
43
44   # FIXME: this should only occur on the bootstrap host (ditto for db syncs)
45   # Create all the database schemas
46   if downcase(hiera('gnocchi_indexer_backend')) == 'mysql' {
47     include ::gnocchi::db::mysql
48   }
49   include ::aodh::db::mysql
50
51 } #END STEP 2
52
53 if hiera('step') >= 4 {
54
55   $nova_ipv6 = hiera('nova::use_ipv6', false)
56   if $nova_ipv6 {
57     $memcached_servers = suffix(hiera('memcache_node_ips_v6'), ':11211')
58   } else {
59     $memcached_servers = suffix(hiera('memcache_node_ips'), ':11211')
60   }
61
62   class { '::nova' :
63     memcached_servers => $memcached_servers
64   }
65   include ::nova::config
66
67   # Aodh
68   class { '::aodh' :
69     database_connection => hiera('aodh_mysql_conn_string'),
70   }
71   include ::aodh::db::sync
72   include ::aodh::auth
73   include ::aodh::api
74   include ::aodh::wsgi::apache
75   include ::aodh::evaluator
76   include ::aodh::notifier
77   include ::aodh::listener
78   include ::aodh::client
79
80   # Gnocchi
81   $gnocchi_database_connection = hiera('gnocchi_mysql_conn_string')
82   class { '::gnocchi':
83     database_connection => $gnocchi_database_connection,
84   }
85   include ::gnocchi::api
86   include ::gnocchi::wsgi::apache
87   include ::gnocchi::client
88   include ::gnocchi::db::sync
89   include ::gnocchi::storage
90   include ::gnocchi::metricd
91   include ::gnocchi::statsd
92   $gnocchi_backend = downcase(hiera('gnocchi_backend', 'swift'))
93   case $gnocchi_backend {
94       'swift': { include ::gnocchi::storage::swift }
95       'file': { include ::gnocchi::storage::file }
96       'rbd': { include ::gnocchi::storage::ceph }
97       default: { fail('Unrecognized gnocchi_backend parameter.') }
98   }
99
100   hiera_include('controller_classes')
101
102 } #END STEP 4
103
104 if hiera('step') >= 5 {
105   $nova_enable_db_purge = hiera('nova_enable_db_purge', true)
106
107   if $nova_enable_db_purge {
108     include ::nova::cron::archive_deleted_rows
109   }
110 } #END STEP 5
111
112 $package_manifest_name = join(['/var/lib/tripleo/installed-packages/overcloud_controller', hiera('step')])
113 package_manifest{$package_manifest_name: ensure => present}