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
21 # TODO(jistr): use pcs resource provider instead of just no-ops
23 tag == 'aodh-service' or
24 tag == 'ceilometer-service' or
25 tag == 'gnocchi-service' or
26 tag == 'neutron-service' or
30 restart => '/bin/true',
35 include ::tripleo::packages
36 include ::tripleo::firewall
38 if $::hostname == downcase(hiera('bootstrap_nodeid')) {
39 $pacemaker_master = true
42 $pacemaker_master = false
46 $enable_fencing = str2bool(hiera('enable_fencing', false)) and hiera('step') >= 5
47 $enable_load_balancer = hiera('enable_load_balancer', true)
49 # When to start and enable services which haven't been Pacemakerized
50 # FIXME: remove when we start all OpenStack services using Pacemaker
51 # (occurrences of this variable will be gradually replaced with false)
52 $non_pcmk_start = hiera('step') >= 5
54 if hiera('step') >= 1 {
56 create_resources(kmod::load, hiera('kernel_modules'), {})
57 create_resources(sysctl::value, hiera('sysctl_settings'), {})
58 Exec <| tag == 'kmod::load' |> -> Sysctl <| |>
62 if count(hiera('ntp::servers')) > 0 {
66 $pacemaker_cluster_members = downcase(regsubst(hiera('controller_node_names'), ',', ' ', 'G'))
67 $corosync_ipv6 = str2bool(hiera('corosync_ipv6', false))
69 $cluster_setup_extras = { '--token' => hiera('corosync_token_timeout', 1000), '--ipv6' => '' }
71 $cluster_setup_extras = { '--token' => hiera('corosync_token_timeout', 1000) }
73 class { '::pacemaker':
74 hacluster_pwd => hiera('hacluster_pwd'),
76 class { '::pacemaker::corosync':
77 cluster_members => $pacemaker_cluster_members,
78 setup_cluster => $pacemaker_master,
79 cluster_setup_extras => $cluster_setup_extras,
81 class { '::pacemaker::stonith':
82 disable => !$enable_fencing,
85 include ::tripleo::fencing
87 # enable stonith after all Pacemaker resources have been created
88 Pcmk_resource<||> -> Class['tripleo::fencing']
89 Pcmk_constraint<||> -> Class['tripleo::fencing']
90 Exec <| tag == 'pacemaker_constraint' |> -> Class['tripleo::fencing']
91 # enable stonith after all fencing devices have been created
92 Class['tripleo::fencing'] -> Class['pacemaker::stonith']
95 # FIXME(gfidente): sets 200secs as default start timeout op
96 # param; until we can use pcmk global defaults we'll still
97 # need to add it to every resource which redefines op params
98 Pacemaker::Resource::Service {
99 op_params => 'start timeout=200s stop timeout=200s',
102 if downcase(hiera('ceilometer_backend')) == 'mongodb' {
103 include ::mongodb::globals
104 include ::mongodb::client
105 class { '::mongodb::server' :
106 service_manage => false,
111 if str2bool(hiera('enable_galera', true)) {
112 $mysql_config_file = '/etc/my.cnf.d/galera.cnf'
114 $mysql_config_file = '/etc/my.cnf.d/server.cnf'
116 $galera_nodes = downcase(hiera('galera_node_names', $::hostname))
117 $galera_nodes_count = count(split($galera_nodes, ','))
119 # FIXME: due to https://bugzilla.redhat.com/show_bug.cgi?id=1298671 we
120 # set bind-address to a hostname instead of an ip address; to move Mysql
121 # from internal_api on another network we'll have to customize both
122 # MysqlNetwork and ControllerHostnameResolveNetwork in ServiceNetMap
123 $mysql_bind_host = hiera('mysql_bind_host')
126 'skip-name-resolve' => '1',
127 'binlog_format' => 'ROW',
128 'default-storage-engine' => 'innodb',
129 'innodb_autoinc_lock_mode' => '2',
130 'innodb_locks_unsafe_for_binlog'=> '1',
131 'query_cache_size' => '0',
132 'query_cache_type' => '0',
133 'bind-address' => $::hostname,
134 'max_connections' => hiera('mysql_max_connections'),
135 'open_files_limit' => '-1',
137 'wsrep_provider' => '/usr/lib64/galera/libgalera_smm.so',
138 'wsrep_cluster_name' => 'galera_cluster',
139 'wsrep_cluster_address' => "gcomm://${galera_nodes}",
140 'wsrep_slave_threads' => '1',
141 'wsrep_certify_nonPK' => '1',
142 'wsrep_max_ws_rows' => '131072',
143 'wsrep_max_ws_size' => '1073741824',
144 'wsrep_debug' => '0',
145 'wsrep_convert_LOCK_to_trx' => '0',
146 'wsrep_retry_autocommit' => '1',
147 'wsrep_auto_increment_control' => '1',
148 'wsrep_drupal_282555_workaround'=> '0',
149 'wsrep_causal_reads' => '0',
150 'wsrep_sst_method' => 'rsync',
151 'wsrep_provider_options' => "gmcast.listen_addr=tcp://[${mysql_bind_host}]:4567;",
155 class { '::mysql::server':
156 create_root_user => false,
157 create_root_my_cnf => false,
158 config_file => $mysql_config_file,
159 override_options => $mysqld_options,
160 remove_default_accounts => $pacemaker_master,
161 service_manage => false,
162 service_enabled => false,
167 if hiera('step') >= 2 {
169 # NOTE(gfidente): the following vars are needed on all nodes so they
170 # need to stay out of pacemaker_master conditional.
171 # The addresses mangling will hopefully go away when we'll be able to
172 # configure the connection string via hostnames, until then, we need to pass
173 # the list of IPv6 addresses *with* port and without the brackets as 'members'
174 # argument for the 'mongodb_replset' resource.
175 if str2bool(hiera('mongodb::server::ipv6', false)) {
176 $mongo_node_ips_with_port_prefixed = prefix(hiera('mongo_node_ips'), '[')
177 $mongo_node_ips_with_port = suffix($mongo_node_ips_with_port_prefixed, ']:27017')
178 $mongo_node_ips_with_port_nobr = suffix(hiera('mongo_node_ips'), ':27017')
180 $mongo_node_ips_with_port = suffix(hiera('mongo_node_ips'), ':27017')
181 $mongo_node_ips_with_port_nobr = suffix(hiera('mongo_node_ips'), ':27017')
183 $mongodb_replset = hiera('mongodb::server::replset')
185 if $pacemaker_master {
187 include ::pacemaker::resource_defaults
189 # Create an openstack-core dummy resource. See RHBZ 1290121
190 pacemaker::resource::ocf { 'openstack-core':
191 ocf_agent_name => 'heartbeat:Dummy',
192 clone_params => true,
195 if downcase(hiera('ceilometer_backend')) == 'mongodb' {
196 pacemaker::resource::service { $::mongodb::params::service_name :
197 op_params => 'start timeout=370s stop timeout=200s',
198 clone_params => true,
199 require => Class['::mongodb::server'],
201 # NOTE (spredzy) : The replset can only be run
202 # once all the nodes have joined the cluster.
203 mongodb_conn_validator { $mongo_node_ips_with_port :
205 require => Pacemaker::Resource::Service[$::mongodb::params::service_name],
206 before => Mongodb_replset[$mongodb_replset],
208 mongodb_replset { $mongodb_replset :
209 members => $mongo_node_ips_with_port_nobr,
213 pacemaker::resource::ocf { 'galera' :
214 ocf_agent_name => 'heartbeat:galera',
215 op_params => 'promote timeout=300s on-fail=block',
217 meta_params => "master-max=${galera_nodes_count} ordered=true",
218 resource_params => "additional_parameters='--open-files-limit=16384' enable_creation=true wsrep_cluster_address='gcomm://${galera_nodes}'",
219 require => Class['::mysql::server'],
220 before => Exec['galera-ready'],
223 $mysql_root_password = hiera('mysql::server::root_password')
224 $mysql_clustercheck_password = hiera('mysql_clustercheck_password')
225 # This step is to create a sysconfig clustercheck file with the root user and empty password
226 # on the first install only (because later on the clustercheck db user will be used)
227 # We are using exec and not file in order to not have duplicate definition errors in puppet
228 # when we later set the the file to contain the clustercheck data
229 exec { 'create-root-sysconfig-clustercheck':
230 command => "/bin/echo 'MYSQL_USERNAME=root\nMYSQL_PASSWORD=\'\'\nMYSQL_HOST=localhost\n' > /etc/sysconfig/clustercheck",
231 unless => '/bin/test -e /etc/sysconfig/clustercheck && grep -q clustercheck /etc/sysconfig/clustercheck',
234 exec { 'galera-ready' :
235 command => '/usr/bin/clustercheck >/dev/null',
239 environment => ['AVAILABLE_WHEN_READONLY=0'],
240 require => Exec['create-root-sysconfig-clustercheck'],
243 xinetd::service { 'galera-monitor' :
245 server => '/usr/bin/clustercheck',
246 per_source => 'UNLIMITED',
247 log_on_success => '',
248 log_on_failure => 'HOST',
250 service_type => 'UNLISTED',
253 require => Exec['create-root-sysconfig-clustercheck'],
255 # We add a clustercheck db user and we will switch /etc/sysconfig/clustercheck
256 # to it in a later step. We do this only on one node as it will replicate on
257 # the other members. We also make sure that the permissions are the minimum necessary
258 if $pacemaker_master {
259 mysql_user { 'clustercheck@localhost':
261 password_hash => mysql_password($mysql_clustercheck_password),
262 require => Exec['galera-ready'],
264 mysql_grant { 'clustercheck@localhost/*.*':
266 options => ['GRANT'],
267 privileges => ['PROCESS'],
269 user => 'clustercheck@localhost',
273 # Create all the database schemas
275 class { '::nova::db::mysql':
276 require => Exec['galera-ready'],
278 class { '::nova::db::mysql_api':
279 require => Exec['galera-ready'],
282 if downcase(hiera('ceilometer_backend')) == 'mysql' {
283 class { '::ceilometer::db::mysql':
284 require => Exec['galera-ready'],
288 if downcase(hiera('gnocchi_indexer_backend')) == 'mysql' {
289 class { '::gnocchi::db::mysql':
290 require => Exec['galera-ready'],
296 $enable_ceph = hiera('ceph_storage_count', 0) > 0 or hiera('enable_ceph_storage', false)
299 $mon_initial_members = downcase(hiera('ceph_mon_initial_members'))
300 if str2bool(hiera('ceph_ipv6', false)) {
301 $mon_host = hiera('ceph_mon_host_v6')
303 $mon_host = hiera('ceph_mon_host')
305 class { '::ceph::profile::params':
306 mon_initial_members => $mon_initial_members,
307 mon_host => $mon_host,
310 include ::ceph::profile::mon
313 if str2bool(hiera('enable_ceph_storage', false)) {
314 if str2bool(hiera('ceph_osd_selinux_permissive', true)) {
315 exec { 'set selinux to permissive on boot':
316 command => "sed -ie 's/^SELINUX=.*/SELINUX=permissive/' /etc/selinux/config",
317 onlyif => "test -f /etc/selinux/config && ! grep '^SELINUX=permissive' /etc/selinux/config",
318 path => ['/usr/bin', '/usr/sbin'],
321 exec { 'set selinux to permissive':
322 command => 'setenforce 0',
323 onlyif => "which setenforce && getenforce | grep -i 'enforcing'",
324 path => ['/usr/bin', '/usr/sbin'],
325 } -> Class['ceph::profile::osd']
329 include ::ceph::profile::osd
332 if str2bool(hiera('enable_external_ceph', false)) {
333 if str2bool(hiera('ceph_ipv6', false)) {
334 $mon_host = hiera('ceph_mon_host_v6')
336 $mon_host = hiera('ceph_mon_host')
338 class { '::ceph::profile::params':
339 mon_host => $mon_host,
342 include ::ceph::profile::client
348 if hiera('step') >= 4 or ( hiera('step') >= 3 and $sync_db ) {
349 # At this stage we are guaranteed that the clustercheck db user exists
350 # so we switch the resource agent to use it.
351 file { '/etc/sysconfig/clustercheck' :
356 content => "MYSQL_USERNAME=clustercheck\n
357 MYSQL_PASSWORD='${mysql_clustercheck_password}'\n
358 MYSQL_HOST=localhost\n",
361 $nova_ipv6 = hiera('nova::use_ipv6', false)
363 $memcached_servers = suffix(hiera('memcache_node_ips_v6'), ':11211')
365 $memcached_servers = suffix(hiera('memcache_node_ips'), ':11211')
369 memcached_servers => $memcached_servers
372 include ::nova::config
374 class { '::nova::api' :
376 sync_db_api => $sync_db,
377 manage_service => false,
380 class { '::nova::consoleauth' :
381 manage_service => false,
384 class { '::nova::vncproxy' :
385 manage_service => false,
388 include ::nova::scheduler::filter
389 class { '::nova::scheduler' :
390 manage_service => false,
393 include ::nova::network::neutron
395 if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
397 # TODO(devvesa) provide non-controller ips for these services
398 $zookeeper_node_ips = hiera('neutron_api_node_ips')
399 $cassandra_node_ips = hiera('neutron_api_node_ips')
401 # Run zookeeper in the controller if configured
402 if hiera('enable_zookeeper_on_controller') {
403 class {'::tripleo::cluster::zookeeper':
404 zookeeper_server_ips => $zookeeper_node_ips,
405 # TODO: create a 'bind' hiera key for zookeeper
406 zookeeper_client_ip => hiera('neutron::bind_host'),
407 zookeeper_hostnames => split(hiera('controller_node_names'), ',')
411 # Run cassandra in the controller if configured
412 if hiera('enable_cassandra_on_controller') {
413 class {'::tripleo::cluster::cassandra':
414 cassandra_servers => $cassandra_node_ips,
415 # TODO: create a 'bind' hiera key for cassandra
416 cassandra_ip => hiera('neutron::bind_host'),
420 class {'::tripleo::network::midonet::agent':
421 zookeeper_servers => $zookeeper_node_ips,
422 cassandra_seeds => $cassandra_node_ips
425 class {'::tripleo::network::midonet::api':
426 zookeeper_servers => $zookeeper_node_ips,
427 vip => hiera('public_virtual_ip'),
428 keystone_ip => hiera('public_virtual_ip'),
429 keystone_admin_token => hiera('keystone::admin_token'),
430 # TODO: create a 'bind' hiera key for api
431 bind_address => hiera('neutron::bind_host'),
432 admin_password => hiera('admin_password')
437 service_plugins => []
442 # Neutron class definitions
446 include ::neutron::config
447 if hiera('neutron::core_plugin') == 'neutron.plugins.nuage.plugin.NuagePlugin' {
448 include ::neutron::plugins::nuage
450 if hiera('neutron::core_plugin') == 'neutron_plugin_contrail.plugins.opencontrail.contrail_plugin.NeutronPluginContrailCoreV2' {
451 include ::neutron::plugins::opencontrail
453 if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
454 class {'::neutron::plugins::midonet':
455 midonet_api_ip => hiera('public_virtual_ip'),
456 keystone_tenant => hiera('neutron::server::auth_tenant'),
457 keystone_password => hiera('neutron::server::password')
460 if hiera('neutron::core_plugin') == 'networking_plumgrid.neutron.plugins.plugin.NeutronPluginPLUMgridV2' {
461 class { '::neutron::plugins::plumgrid' :
462 connection => hiera('neutron::server::database_connection'),
463 controller_priv_host => hiera('keystone_admin_api_vip'),
464 admin_password => hiera('admin_password'),
465 metadata_proxy_shared_secret => hiera('nova::api::neutron_metadata_proxy_shared_secret'),
470 $ceph_pools = hiera('ceph_pools')
471 ceph::pool { $ceph_pools :
472 pg_num => hiera('ceph::profile::params::osd_pool_default_pg_num'),
473 pgp_num => hiera('ceph::profile::params::osd_pool_default_pgp_num'),
474 size => hiera('ceph::profile::params::osd_pool_default_size'),
479 if str2bool(hiera('enable_swift_storage', true)) {
480 class {'::swift::storage::all':
481 mount_check => str2bool(hiera('swift_mount_check')),
483 class {'::swift::storage::account':
484 manage_service => $non_pcmk_start,
485 enabled => $non_pcmk_start,
487 class {'::swift::storage::container':
488 manage_service => $non_pcmk_start,
489 enabled => $non_pcmk_start,
491 class {'::swift::storage::object':
492 manage_service => $non_pcmk_start,
493 enabled => $non_pcmk_start,
495 if(!defined(File['/srv/node'])) {
500 require => Package['openstack-swift'],
503 $swift_components = ['account', 'container', 'object']
504 swift::storage::filter::recon { $swift_components : }
505 swift::storage::filter::healthcheck { $swift_components : }
509 case downcase(hiera('ceilometer_backend')) {
511 $ceilometer_database_connection = hiera('ceilometer_mysql_conn_string')
514 $mongo_node_string = join($mongo_node_ips_with_port, ',')
515 $ceilometer_database_connection = "mongodb://${mongo_node_string}/ceilometer?replicaSet=${mongodb_replset}"
519 include ::ceilometer::config
520 class { '::ceilometer::api' :
521 manage_service => false,
524 class { '::ceilometer::agent::notification' :
525 manage_service => false,
528 class { '::ceilometer::agent::central' :
529 manage_service => false,
532 class { '::ceilometer::collector' :
533 manage_service => false,
536 include ::ceilometer::expirer
537 class { '::ceilometer::db' :
538 database_connection => $ceilometer_database_connection,
541 include ::ceilometer::agent::auth
542 include ::ceilometer::dispatcher::gnocchi
544 Cron <| title == 'ceilometer-expirer' |> { command => "sleep $((\$(od -A n -t d -N 3 /dev/urandom) % 86400)) && ${::ceilometer::params::expirer_command}" }
546 # httpd/apache and horizon
547 # NOTE(gfidente): server-status can be consumed by the pacemaker resource agent
549 service_enable => false,
550 # service_manage => false, # <-- not supported with horizon&apache mod_wsgi?
552 include ::apache::mod::remoteip
553 include ::apache::mod::status
554 if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') {
555 $_profile_support = 'cisco'
557 $_profile_support = 'None'
559 $neutron_options = {'profile_support' => $_profile_support }
561 $memcached_ipv6 = hiera('memcached_ipv6', false)
563 $horizon_memcached_servers = hiera('memcache_node_ips_v6', '[::1]')
565 $horizon_memcached_servers = hiera('memcache_node_ips', '127.0.0.1')
569 cache_server_ip => $horizon_memcached_servers,
570 neutron_options => $neutron_options,
575 database_connection => $ceilometer_database_connection,
577 include ::aodh::config
579 include ::aodh::client
580 include ::aodh::wsgi::apache
581 class { '::aodh::api':
582 manage_service => false,
584 service_name => 'httpd',
586 class { '::aodh::evaluator':
587 manage_service => false,
590 class { '::aodh::notifier':
591 manage_service => false,
594 class { '::aodh::listener':
595 manage_service => false,
600 $gnocchi_database_connection = hiera('gnocchi_mysql_conn_string')
601 include ::gnocchi::client
603 include ::gnocchi::db::sync
605 include ::gnocchi::storage
606 $gnocchi_backend = downcase(hiera('gnocchi_backend', 'swift'))
607 case $gnocchi_backend {
608 'swift': { include ::gnocchi::storage::swift }
609 'file': { include ::gnocchi::storage::file }
610 'rbd': { include ::gnocchi::storage::ceph }
611 default: { fail('Unrecognized gnocchi_backend parameter.') }
614 database_connection => $gnocchi_database_connection,
616 class { '::gnocchi::api' :
617 manage_service => false,
619 service_name => 'httpd',
621 class { '::gnocchi::wsgi::apache' :
624 class { '::gnocchi::metricd' :
625 manage_service => false,
628 class { '::gnocchi::statsd' :
629 manage_service => false,
633 $snmpd_user = hiera('snmpd_readonly_user_name')
634 snmp::snmpv3_user { $snmpd_user:
636 authpass => hiera('snmpd_readonly_user_password'),
639 agentaddress => ['udp:161','udp6:[::1]:161'],
640 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' ],
643 hiera_include('controller_classes')
647 if hiera('step') >= 5 {
648 # We now make sure that the root db password is set to a random one
649 # At first installation /root/.my.cnf will be empty and we connect without a root
650 # password. On second runs or updates /root/.my.cnf will already be populated
651 # with proper credentials. This step happens on every node because this sql
652 # statement does not automatically replicate across nodes.
653 exec { 'galera-set-root-password':
654 command => "/bin/touch /root/.my.cnf && /bin/echo \"UPDATE mysql.user SET Password = PASSWORD('${mysql_root_password}') WHERE user = 'root'; flush privileges;\" | /bin/mysql --defaults-extra-file=/root/.my.cnf -u root",
656 file { '/root/.my.cnf' :
663 password=\"${mysql_root_password}\"
667 password=\"${mysql_root_password}\"",
668 require => Exec['galera-set-root-password'],
671 $nova_enable_db_purge = hiera('nova_enable_db_purge', true)
673 if $nova_enable_db_purge {
674 include ::nova::cron::archive_deleted_rows
677 if $pacemaker_master {
679 pacemaker::constraint::base { 'openstack-core-then-httpd-constraint':
680 constraint_type => 'order',
681 first_resource => 'openstack-core-clone',
682 second_resource => "${::apache::params::service_name}-clone",
683 first_action => 'start',
684 second_action => 'start',
685 require => [Pacemaker::Resource::Service[$::apache::params::service_name],
686 Pacemaker::Resource::Ocf['openstack-core']],
688 pacemaker::constraint::base { 'galera-then-openstack-core-constraint':
689 constraint_type => 'order',
690 first_resource => 'galera-master',
691 second_resource => 'openstack-core-clone',
692 first_action => 'promote',
693 second_action => 'start',
694 require => [Pacemaker::Resource::Ocf['galera'],
695 Pacemaker::Resource::Ocf['openstack-core']],
698 if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
699 pacemaker::resource::service {'tomcat':
700 clone_params => 'interleave=true',
703 if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
704 #midonet-chain chain keystone-->neutron-server-->dhcp-->metadata->tomcat
705 pacemaker::constraint::base { 'neutron-server-to-dhcp-agent-constraint':
706 constraint_type => 'order',
707 first_resource => "${::neutron::params::server_service}-clone",
708 second_resource => "${::neutron::params::dhcp_agent_service}-clone",
709 first_action => 'start',
710 second_action => 'start',
711 require => [Pacemaker::Resource::Service[$::neutron::params::server_service],
712 Pacemaker::Resource::Service[$::neutron::params::dhcp_agent_service]],
714 pacemaker::constraint::base { 'neutron-dhcp-agent-to-metadata-agent-constraint':
715 constraint_type => 'order',
716 first_resource => "${::neutron::params::dhcp_agent_service}-clone",
717 second_resource => "${::neutron::params::metadata_agent_service}-clone",
718 first_action => 'start',
719 second_action => 'start',
720 require => [Pacemaker::Resource::Service[$::neutron::params::dhcp_agent_service],
721 Pacemaker::Resource::Service[$::neutron::params::metadata_agent_service]],
723 pacemaker::constraint::base { 'neutron-metadata-agent-to-tomcat-constraint':
724 constraint_type => 'order',
725 first_resource => "${::neutron::params::metadata_agent_service}-clone",
726 second_resource => 'tomcat-clone',
727 first_action => 'start',
728 second_action => 'start',
729 require => [Pacemaker::Resource::Service[$::neutron::params::metadata_agent_service],
730 Pacemaker::Resource::Service['tomcat']],
732 pacemaker::constraint::colocation { 'neutron-dhcp-agent-to-metadata-agent-colocation':
733 source => "${::neutron::params::metadata_agent_service}-clone",
734 target => "${::neutron::params::dhcp_agent_service}-clone",
736 require => [Pacemaker::Resource::Service[$::neutron::params::dhcp_agent_service],
737 Pacemaker::Resource::Service[$::neutron::params::metadata_agent_service]],
742 pacemaker::resource::service { $::nova::params::api_service_name :
743 clone_params => 'interleave=true',
745 pacemaker::resource::service { $::nova::params::consoleauth_service_name :
746 clone_params => 'interleave=true',
747 require => Pacemaker::Resource::Ocf['openstack-core'],
749 pacemaker::resource::service { $::nova::params::vncproxy_service_name :
750 clone_params => 'interleave=true',
752 pacemaker::resource::service { $::nova::params::scheduler_service_name :
753 clone_params => 'interleave=true',
756 pacemaker::constraint::base { 'keystone-then-nova-consoleauth-constraint':
757 constraint_type => 'order',
758 first_resource => 'openstack-core-clone',
759 second_resource => "${::nova::params::consoleauth_service_name}-clone",
760 first_action => 'start',
761 second_action => 'start',
762 require => [Pacemaker::Resource::Service[$::nova::params::consoleauth_service_name],
763 Pacemaker::Resource::Ocf['openstack-core']],
765 pacemaker::constraint::base { 'nova-consoleauth-then-nova-vncproxy-constraint':
766 constraint_type => 'order',
767 first_resource => "${::nova::params::consoleauth_service_name}-clone",
768 second_resource => "${::nova::params::vncproxy_service_name}-clone",
769 first_action => 'start',
770 second_action => 'start',
771 require => [Pacemaker::Resource::Service[$::nova::params::consoleauth_service_name],
772 Pacemaker::Resource::Service[$::nova::params::vncproxy_service_name]],
774 pacemaker::constraint::colocation { 'nova-vncproxy-with-nova-consoleauth-colocation':
775 source => "${::nova::params::vncproxy_service_name}-clone",
776 target => "${::nova::params::consoleauth_service_name}-clone",
778 require => [Pacemaker::Resource::Service[$::nova::params::consoleauth_service_name],
779 Pacemaker::Resource::Service[$::nova::params::vncproxy_service_name]],
781 pacemaker::constraint::base { 'nova-vncproxy-then-nova-api-constraint':
782 constraint_type => 'order',
783 first_resource => "${::nova::params::vncproxy_service_name}-clone",
784 second_resource => "${::nova::params::api_service_name}-clone",
785 first_action => 'start',
786 second_action => 'start',
787 require => [Pacemaker::Resource::Service[$::nova::params::vncproxy_service_name],
788 Pacemaker::Resource::Service[$::nova::params::api_service_name]],
790 pacemaker::constraint::colocation { 'nova-api-with-nova-vncproxy-colocation':
791 source => "${::nova::params::api_service_name}-clone",
792 target => "${::nova::params::vncproxy_service_name}-clone",
794 require => [Pacemaker::Resource::Service[$::nova::params::vncproxy_service_name],
795 Pacemaker::Resource::Service[$::nova::params::api_service_name]],
797 pacemaker::constraint::base { 'nova-api-then-nova-scheduler-constraint':
798 constraint_type => 'order',
799 first_resource => "${::nova::params::api_service_name}-clone",
800 second_resource => "${::nova::params::scheduler_service_name}-clone",
801 first_action => 'start',
802 second_action => 'start',
803 require => [Pacemaker::Resource::Service[$::nova::params::api_service_name],
804 Pacemaker::Resource::Service[$::nova::params::scheduler_service_name]],
806 pacemaker::constraint::colocation { 'nova-scheduler-with-nova-api-colocation':
807 source => "${::nova::params::scheduler_service_name}-clone",
808 target => "${::nova::params::api_service_name}-clone",
810 require => [Pacemaker::Resource::Service[$::nova::params::api_service_name],
811 Pacemaker::Resource::Service[$::nova::params::scheduler_service_name]],
813 pacemaker::constraint::base { 'nova-scheduler-then-nova-conductor-constraint':
814 constraint_type => 'order',
815 first_resource => "${::nova::params::scheduler_service_name}-clone",
816 second_resource => "${::nova::params::conductor_service_name}-clone",
817 first_action => 'start',
818 second_action => 'start',
819 require => [Pacemaker::Resource::Service[$::nova::params::scheduler_service_name],
820 Pacemaker::Resource::Service[$::nova::params::conductor_service_name]],
822 pacemaker::constraint::colocation { 'nova-conductor-with-nova-scheduler-colocation':
823 source => "${::nova::params::conductor_service_name}-clone",
824 target => "${::nova::params::scheduler_service_name}-clone",
826 require => [Pacemaker::Resource::Service[$::nova::params::scheduler_service_name],
827 Pacemaker::Resource::Service[$::nova::params::conductor_service_name]],
830 # Ceilometer and Aodh
831 case downcase(hiera('ceilometer_backend')) {
833 pacemaker::resource::service { $::ceilometer::params::agent_central_service_name:
834 clone_params => 'interleave=true',
835 require => Pacemaker::Resource::Ocf['openstack-core'],
839 pacemaker::resource::service { $::ceilometer::params::agent_central_service_name:
840 clone_params => 'interleave=true',
841 require => [Pacemaker::Resource::Ocf['openstack-core'],
842 Pacemaker::Resource::Service[$::mongodb::params::service_name]],
846 pacemaker::resource::service { $::ceilometer::params::collector_service_name :
847 clone_params => 'interleave=true',
849 pacemaker::resource::service { $::ceilometer::params::api_service_name :
850 clone_params => 'interleave=true',
852 pacemaker::resource::service { $::ceilometer::params::agent_notification_service_name :
853 clone_params => 'interleave=true',
855 # Fedora doesn't know `require-all` parameter for constraints yet
856 if $::operatingsystem == 'Fedora' {
857 $redis_ceilometer_constraint_params = undef
858 $redis_aodh_constraint_params = undef
860 $redis_ceilometer_constraint_params = 'require-all=false'
861 $redis_aodh_constraint_params = 'require-all=false'
863 pacemaker::constraint::base { 'redis-then-ceilometer-central-constraint':
864 constraint_type => 'order',
865 first_resource => 'redis-master',
866 second_resource => "${::ceilometer::params::agent_central_service_name}-clone",
867 first_action => 'promote',
868 second_action => 'start',
869 constraint_params => $redis_ceilometer_constraint_params,
870 require => [Pacemaker::Resource::Ocf['redis'],
871 Pacemaker::Resource::Service[$::ceilometer::params::agent_central_service_name]],
873 pacemaker::constraint::base { 'redis-then-aodh-evaluator-constraint':
874 constraint_type => 'order',
875 first_resource => 'redis-master',
876 second_resource => "${::aodh::params::evaluator_service_name}-clone",
877 first_action => 'promote',
878 second_action => 'start',
879 constraint_params => $redis_aodh_constraint_params,
880 require => [Pacemaker::Resource::Ocf['redis'],
881 Pacemaker::Resource::Service[$::aodh::params::evaluator_service_name]],
883 pacemaker::constraint::base { 'keystone-then-ceilometer-central-constraint':
884 constraint_type => 'order',
885 first_resource => 'openstack-core-clone',
886 second_resource => "${::ceilometer::params::agent_central_service_name}-clone",
887 first_action => 'start',
888 second_action => 'start',
889 require => [Pacemaker::Resource::Service[$::ceilometer::params::agent_central_service_name],
890 Pacemaker::Resource::Ocf['openstack-core']],
892 pacemaker::constraint::base { 'keystone-then-ceilometer-notification-constraint':
893 constraint_type => 'order',
894 first_resource => 'openstack-core-clone',
895 second_resource => "${::ceilometer::params::agent_notification_service_name}-clone",
896 first_action => 'start',
897 second_action => 'start',
898 require => [Pacemaker::Resource::Service[$::ceilometer::params::agent_central_service_name],
899 Pacemaker::Resource::Ocf['openstack-core']],
901 pacemaker::constraint::base { 'ceilometer-central-then-ceilometer-collector-constraint':
902 constraint_type => 'order',
903 first_resource => "${::ceilometer::params::agent_central_service_name}-clone",
904 second_resource => "${::ceilometer::params::collector_service_name}-clone",
905 first_action => 'start',
906 second_action => 'start',
907 require => [Pacemaker::Resource::Service[$::ceilometer::params::agent_central_service_name],
908 Pacemaker::Resource::Service[$::ceilometer::params::collector_service_name]],
910 pacemaker::constraint::base { 'ceilometer-collector-then-ceilometer-api-constraint':
911 constraint_type => 'order',
912 first_resource => "${::ceilometer::params::collector_service_name}-clone",
913 second_resource => "${::ceilometer::params::api_service_name}-clone",
914 first_action => 'start',
915 second_action => 'start',
916 require => [Pacemaker::Resource::Service[$::ceilometer::params::collector_service_name],
917 Pacemaker::Resource::Service[$::ceilometer::params::api_service_name]],
919 pacemaker::constraint::colocation { 'ceilometer-api-with-ceilometer-collector-colocation':
920 source => "${::ceilometer::params::api_service_name}-clone",
921 target => "${::ceilometer::params::collector_service_name}-clone",
923 require => [Pacemaker::Resource::Service[$::ceilometer::params::api_service_name],
924 Pacemaker::Resource::Service[$::ceilometer::params::collector_service_name]],
927 pacemaker::resource::service { $::aodh::params::evaluator_service_name :
928 clone_params => 'interleave=true',
930 pacemaker::resource::service { $::aodh::params::notifier_service_name :
931 clone_params => 'interleave=true',
933 pacemaker::resource::service { $::aodh::params::listener_service_name :
934 clone_params => 'interleave=true',
936 pacemaker::constraint::base { 'aodh-evaluator-then-aodh-notifier-constraint':
937 constraint_type => 'order',
938 first_resource => "${::aodh::params::evaluator_service_name}-clone",
939 second_resource => "${::aodh::params::notifier_service_name}-clone",
940 first_action => 'start',
941 second_action => 'start',
942 require => [Pacemaker::Resource::Service[$::aodh::params::evaluator_service_name],
943 Pacemaker::Resource::Service[$::aodh::params::notifier_service_name]],
945 pacemaker::constraint::colocation { 'aodh-notifier-with-aodh-evaluator-colocation':
946 source => "${::aodh::params::notifier_service_name}-clone",
947 target => "${::aodh::params::evaluator_service_name}-clone",
949 require => [Pacemaker::Resource::Service[$::aodh::params::evaluator_service_name],
950 Pacemaker::Resource::Service[$::aodh::params::notifier_service_name]],
952 pacemaker::constraint::base { 'aodh-evaluator-then-aodh-listener-constraint':
953 constraint_type => 'order',
954 first_resource => "${::aodh::params::evaluator_service_name}-clone",
955 second_resource => "${::aodh::params::listener_service_name}-clone",
956 first_action => 'start',
957 second_action => 'start',
958 require => [Pacemaker::Resource::Service[$::aodh::params::evaluator_service_name],
959 Pacemaker::Resource::Service[$::aodh::params::listener_service_name]],
961 pacemaker::constraint::colocation { 'aodh-listener-with-aodh-evaluator-colocation':
962 source => "${::aodh::params::listener_service_name}-clone",
963 target => "${::aodh::params::evaluator_service_name}-clone",
965 require => [Pacemaker::Resource::Service[$::aodh::params::evaluator_service_name],
966 Pacemaker::Resource::Service[$::aodh::params::listener_service_name]],
968 if downcase(hiera('ceilometer_backend')) == 'mongodb' {
969 pacemaker::constraint::base { 'mongodb-then-ceilometer-central-constraint':
970 constraint_type => 'order',
971 first_resource => "${::mongodb::params::service_name}-clone",
972 second_resource => "${::ceilometer::params::agent_central_service_name}-clone",
973 first_action => 'start',
974 second_action => 'start',
975 require => [Pacemaker::Resource::Service[$::ceilometer::params::agent_central_service_name],
976 Pacemaker::Resource::Service[$::mongodb::params::service_name]],
981 pacemaker::resource::service { $::gnocchi::params::metricd_service_name :
982 clone_params => 'interleave=true',
984 pacemaker::resource::service { $::gnocchi::params::statsd_service_name :
985 clone_params => 'interleave=true',
987 pacemaker::constraint::base { 'gnocchi-metricd-then-gnocchi-statsd-constraint':
988 constraint_type => 'order',
989 first_resource => "${::gnocchi::params::metricd_service_name}-clone",
990 second_resource => "${::gnocchi::params::statsd_service_name}-clone",
991 first_action => 'start',
992 second_action => 'start',
993 require => [Pacemaker::Resource::Service[$::gnocchi::params::metricd_service_name],
994 Pacemaker::Resource::Service[$::gnocchi::params::statsd_service_name]],
996 pacemaker::constraint::colocation { 'gnocchi-statsd-with-metricd-colocation':
997 source => "${::gnocchi::params::statsd_service_name}-clone",
998 target => "${::gnocchi::params::metricd_service_name}-clone",
1000 require => [Pacemaker::Resource::Service[$::gnocchi::params::metricd_service_name],
1001 Pacemaker::Resource::Service[$::gnocchi::params::statsd_service_name]],
1004 # Horizon and Keystone
1005 pacemaker::resource::service { $::apache::params::service_name:
1006 clone_params => 'interleave=true',
1007 verify_on_create => true,
1008 require => [File['/etc/keystone/ssl/certs/ca.pem'],
1009 File['/etc/keystone/ssl/private/signing_key.pem'],
1010 File['/etc/keystone/ssl/certs/signing_cert.pem']],
1014 if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') {
1015 pacemaker::resource::ocf { 'vsm-p' :
1016 ocf_agent_name => 'heartbeat:VirtualDomain',
1017 resource_params => 'force_stop=true config=/var/spool/cisco/vsm/vsm_primary_deploy.xml',
1018 require => Class['n1k_vsm'],
1019 meta_params => 'resource-stickiness=INFINITY',
1021 if str2bool(hiera('n1k_vsm::pacemaker_control', true)) {
1022 pacemaker::resource::ocf { 'vsm-s' :
1023 ocf_agent_name => 'heartbeat:VirtualDomain',
1024 resource_params => 'force_stop=true config=/var/spool/cisco/vsm/vsm_secondary_deploy.xml',
1025 require => Class['n1k_vsm'],
1026 meta_params => 'resource-stickiness=INFINITY',
1028 pacemaker::constraint::colocation { 'vsm-colocation-contraint':
1031 score => '-INFINITY',
1032 require => [Pacemaker::Resource::Ocf['vsm-p'],
1033 Pacemaker::Resource::Ocf['vsm-s']],
1042 $package_manifest_name = join(['/var/lib/tripleo/installed-packages/overcloud_controller_pacemaker', hiera('step')])
1043 package_manifest{$package_manifest_name: ensure => present}