1 # Copyright 2015 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 # TODO(jistr): use pcs resource provider instead of just no-ops
21 restart => '/bin/true',
26 include ::tripleo::packages
27 include ::tripleo::firewall
29 if $::hostname == downcase(hiera('bootstrap_nodeid')) {
30 $pacemaker_master = true
33 $pacemaker_master = false
37 if hiera('step') >= 2 {
38 # NOTE(gfidente): the following vars are needed on all nodes so they
39 # need to stay out of pacemaker_master conditional.
40 # The addresses mangling will hopefully go away when we'll be able to
41 # configure the connection string via hostnames, until then, we need to pass
42 # the list of IPv6 addresses *with* port and without the brackets as 'members'
43 # argument for the 'mongodb_replset' resource.
44 if str2bool(hiera('mongodb::server::ipv6', false)) {
45 $mongo_node_ips_with_port_prefixed = prefix(hiera('mongo_node_ips'), '[')
46 $mongo_node_ips_with_port = suffix($mongo_node_ips_with_port_prefixed, ']:27017')
47 $mongo_node_ips_with_port_nobr = suffix(hiera('mongo_node_ips'), ':27017')
49 $mongo_node_ips_with_port = suffix(hiera('mongo_node_ips'), ':27017')
50 $mongo_node_ips_with_port_nobr = suffix(hiera('mongo_node_ips'), ':27017')
52 $mongodb_replset = hiera('mongodb::server::replset')
54 if $pacemaker_master {
55 class { '::aodh::db::mysql':
56 require => Exec['galera-ready'],
61 if hiera('step') >= 4 or ( hiera('step') >= 3 and $sync_db ) {
62 $nova_ipv6 = hiera('nova::use_ipv6', false)
64 $memcached_servers = suffix(hiera('memcache_node_ips_v6'), ':11211')
66 $memcached_servers = suffix(hiera('memcache_node_ips'), ':11211')
70 memcached_servers => $memcached_servers
73 include ::nova::config
77 database_connection => hiera('aodh_mysql_conn_string'),
79 include ::aodh::config
81 include ::aodh::client
82 include ::aodh::wsgi::apache
83 class { '::aodh::api':
84 manage_service => false,
86 service_name => 'httpd',
88 class { '::aodh::evaluator':
89 manage_service => false,
92 class { '::aodh::notifier':
93 manage_service => false,
96 class { '::aodh::listener':
97 manage_service => false,
101 hiera_include('controller_classes')
105 if hiera('step') >= 5 {
106 $nova_enable_db_purge = hiera('nova_enable_db_purge', true)
107 if $nova_enable_db_purge {
108 include ::nova::cron::archive_deleted_rows
111 if $pacemaker_master {
113 pacemaker::constraint::base { 'openstack-core-then-httpd-constraint':
114 constraint_type => 'order',
115 first_resource => 'openstack-core-clone',
116 second_resource => "${::apache::params::service_name}-clone",
117 first_action => 'start',
118 second_action => 'start',
119 require => [Pacemaker::Resource::Service[$::apache::params::service_name],
120 Pacemaker::Resource::Ocf['openstack-core']],
124 pacemaker::constraint::base { 'keystone-then-nova-consoleauth-constraint':
125 constraint_type => 'order',
126 first_resource => 'openstack-core-clone',
127 second_resource => "${::nova::params::consoleauth_service_name}-clone",
128 first_action => 'start',
129 second_action => 'start',
130 require => [Pacemaker::Resource::Service[$::nova::params::consoleauth_service_name],
131 Pacemaker::Resource::Ocf['openstack-core']],
133 pacemaker::constraint::colocation { 'nova-consoleauth-with-openstack-core':
134 source => "${::nova::params::consoleauth_service_name}-clone",
135 target => 'openstack-core-clone',
137 require => [Pacemaker::Resource::Service[$::nova::params::consoleauth_service_name],
138 Pacemaker::Resource::Ocf['openstack-core']],
140 pacemaker::constraint::base { 'nova-consoleauth-then-nova-vncproxy-constraint':
141 constraint_type => 'order',
142 first_resource => "${::nova::params::consoleauth_service_name}-clone",
143 second_resource => "${::nova::params::vncproxy_service_name}-clone",
144 first_action => 'start',
145 second_action => 'start',
146 require => [Pacemaker::Resource::Service[$::nova::params::consoleauth_service_name],
147 Pacemaker::Resource::Service[$::nova::params::vncproxy_service_name]],
149 pacemaker::constraint::colocation { 'nova-vncproxy-with-nova-consoleauth-colocation':
150 source => "${::nova::params::vncproxy_service_name}-clone",
151 target => "${::nova::params::consoleauth_service_name}-clone",
153 require => [Pacemaker::Resource::Service[$::nova::params::consoleauth_service_name],
154 Pacemaker::Resource::Service[$::nova::params::vncproxy_service_name]],
156 pacemaker::constraint::base { 'nova-vncproxy-then-nova-api-constraint':
157 constraint_type => 'order',
158 first_resource => "${::nova::params::vncproxy_service_name}-clone",
159 second_resource => "${::nova::params::api_service_name}-clone",
160 first_action => 'start',
161 second_action => 'start',
162 require => [Pacemaker::Resource::Service[$::nova::params::vncproxy_service_name],
163 Pacemaker::Resource::Service[$::nova::params::api_service_name]],
165 pacemaker::constraint::colocation { 'nova-api-with-nova-vncproxy-colocation':
166 source => "${::nova::params::api_service_name}-clone",
167 target => "${::nova::params::vncproxy_service_name}-clone",
169 require => [Pacemaker::Resource::Service[$::nova::params::vncproxy_service_name],
170 Pacemaker::Resource::Service[$::nova::params::api_service_name]],
172 pacemaker::constraint::base { 'nova-api-then-nova-scheduler-constraint':
173 constraint_type => 'order',
174 first_resource => "${::nova::params::api_service_name}-clone",
175 second_resource => "${::nova::params::scheduler_service_name}-clone",
176 first_action => 'start',
177 second_action => 'start',
178 require => [Pacemaker::Resource::Service[$::nova::params::api_service_name],
179 Pacemaker::Resource::Service[$::nova::params::scheduler_service_name]],
181 pacemaker::constraint::colocation { 'nova-scheduler-with-nova-api-colocation':
182 source => "${::nova::params::scheduler_service_name}-clone",
183 target => "${::nova::params::api_service_name}-clone",
185 require => [Pacemaker::Resource::Service[$::nova::params::api_service_name],
186 Pacemaker::Resource::Service[$::nova::params::scheduler_service_name]],
188 pacemaker::constraint::base { 'nova-scheduler-then-nova-conductor-constraint':
189 constraint_type => 'order',
190 first_resource => "${::nova::params::scheduler_service_name}-clone",
191 second_resource => "${::nova::params::conductor_service_name}-clone",
192 first_action => 'start',
193 second_action => 'start',
194 require => [Pacemaker::Resource::Service[$::nova::params::scheduler_service_name],
195 Pacemaker::Resource::Service[$::nova::params::conductor_service_name]],
197 pacemaker::constraint::colocation { 'nova-conductor-with-nova-scheduler-colocation':
198 source => "${::nova::params::conductor_service_name}-clone",
199 target => "${::nova::params::scheduler_service_name}-clone",
201 require => [Pacemaker::Resource::Service[$::nova::params::scheduler_service_name],
202 Pacemaker::Resource::Service[$::nova::params::conductor_service_name]],
205 # Fedora doesn't know `require-all` parameter for constraints yet
206 if $::operatingsystem == 'Fedora' {
207 $redis_aodh_constraint_params = undef
209 $redis_aodh_constraint_params = 'require-all=false'
211 pacemaker::constraint::base { 'redis-then-aodh-evaluator-constraint':
212 constraint_type => 'order',
213 first_resource => 'redis-master',
214 second_resource => "${::aodh::params::evaluator_service_name}-clone",
215 first_action => 'promote',
216 second_action => 'start',
217 constraint_params => $redis_aodh_constraint_params,
218 require => [Pacemaker::Resource::Ocf['redis'],
219 Pacemaker::Resource::Service[$::aodh::params::evaluator_service_name]],
222 pacemaker::resource::service { $::aodh::params::evaluator_service_name :
223 clone_params => 'interleave=true',
225 pacemaker::resource::service { $::aodh::params::notifier_service_name :
226 clone_params => 'interleave=true',
228 pacemaker::resource::service { $::aodh::params::listener_service_name :
229 clone_params => 'interleave=true',
231 pacemaker::constraint::base { 'aodh-evaluator-then-aodh-notifier-constraint':
232 constraint_type => 'order',
233 first_resource => "${::aodh::params::evaluator_service_name}-clone",
234 second_resource => "${::aodh::params::notifier_service_name}-clone",
235 first_action => 'start',
236 second_action => 'start',
237 require => [Pacemaker::Resource::Service[$::aodh::params::evaluator_service_name],
238 Pacemaker::Resource::Service[$::aodh::params::notifier_service_name]],
240 pacemaker::constraint::colocation { 'aodh-notifier-with-aodh-evaluator-colocation':
241 source => "${::aodh::params::notifier_service_name}-clone",
242 target => "${::aodh::params::evaluator_service_name}-clone",
244 require => [Pacemaker::Resource::Service[$::aodh::params::evaluator_service_name],
245 Pacemaker::Resource::Service[$::aodh::params::notifier_service_name]],
247 pacemaker::constraint::base { 'aodh-evaluator-then-aodh-listener-constraint':
248 constraint_type => 'order',
249 first_resource => "${::aodh::params::evaluator_service_name}-clone",
250 second_resource => "${::aodh::params::listener_service_name}-clone",
251 first_action => 'start',
252 second_action => 'start',
253 require => [Pacemaker::Resource::Service[$::aodh::params::evaluator_service_name],
254 Pacemaker::Resource::Service[$::aodh::params::listener_service_name]],
256 pacemaker::constraint::colocation { 'aodh-listener-with-aodh-evaluator-colocation':
257 source => "${::aodh::params::listener_service_name}-clone",
258 target => "${::aodh::params::evaluator_service_name}-clone",
260 require => [Pacemaker::Resource::Service[$::aodh::params::evaluator_service_name],
261 Pacemaker::Resource::Service[$::aodh::params::listener_service_name]],
264 # Horizon and Keystone
265 pacemaker::resource::service { $::apache::params::service_name:
266 clone_params => 'interleave=true',
267 verify_on_create => true,
268 require => [File['/etc/keystone/ssl/certs/ca.pem'],
269 File['/etc/keystone/ssl/private/signing_key.pem'],
270 File['/etc/keystone/ssl/certs/signing_cert.pem']],
274 if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') {
275 pacemaker::resource::ocf { 'vsm-p' :
276 ocf_agent_name => 'heartbeat:VirtualDomain',
277 resource_params => 'force_stop=true config=/var/spool/cisco/vsm/vsm_primary_deploy.xml',
278 require => Class['n1k_vsm'],
279 meta_params => 'resource-stickiness=INFINITY',
281 if str2bool(hiera('n1k_vsm::pacemaker_control', true)) {
282 pacemaker::resource::ocf { 'vsm-s' :
283 ocf_agent_name => 'heartbeat:VirtualDomain',
284 resource_params => 'force_stop=true config=/var/spool/cisco/vsm/vsm_secondary_deploy.xml',
285 require => Class['n1k_vsm'],
286 meta_params => 'resource-stickiness=INFINITY',
288 pacemaker::constraint::colocation { 'vsm-colocation-contraint':
291 score => '-INFINITY',
292 require => [Pacemaker::Resource::Ocf['vsm-p'],
293 Pacemaker::Resource::Ocf['vsm-s']],
302 $package_manifest_name = join(['/var/lib/tripleo/installed-packages/overcloud_controller_pacemaker', hiera('step')])
303 package_manifest{$package_manifest_name: ensure => present}