diff options
Diffstat (limited to 'manifests/profile/pacemaker')
-rw-r--r-- | manifests/profile/pacemaker/cinder/api.pp | 67 | ||||
-rw-r--r-- | manifests/profile/pacemaker/cinder/scheduler.pp | 72 | ||||
-rw-r--r-- | manifests/profile/pacemaker/cinder/volume.pp | 70 | ||||
-rw-r--r-- | manifests/profile/pacemaker/database/redis.pp | 63 | ||||
-rw-r--r-- | manifests/profile/pacemaker/loadbalancer.pp | 52 | ||||
-rw-r--r-- | manifests/profile/pacemaker/sahara.pp | 81 |
6 files changed, 368 insertions, 37 deletions
diff --git a/manifests/profile/pacemaker/cinder/api.pp b/manifests/profile/pacemaker/cinder/api.pp new file mode 100644 index 0000000..2c9cedf --- /dev/null +++ b/manifests/profile/pacemaker/cinder/api.pp @@ -0,0 +1,67 @@ +# Copyright 2016 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# == Class: tripleo::profile::pacemaker::cinder::api +# +# Cinder API Pacemaker HA profile for tripleo +# +# === Parameters +# +# [*bootstrap_node*] +# (Optional) The hostname of the node responsible for bootstrapping tasks +# Defaults to hiera('bootstrap_nodeid') +# +# [*step*] +# (Optional) The current step in deployment. See tripleo-heat-templates +# for more details. +# Defaults to hiera('step') +# +class tripleo::profile::pacemaker::cinder::api ( + $bootstrap_node = hiera('bootstrap_nodeid'), + $step = hiera('step'), +) { + + Service <| tag == 'cinder-service' |> { + hasrestart => true, + restart => '/bin/true', + start => '/bin/true', + stop => '/bin/true', + } + + if $::hostname == downcase($bootstrap_node) { + $pacemaker_master = true + } else { + $pacemaker_master = false + } + + class { '::tripleo::profile::base::cinder::api': + sync_db => $pacemaker_master, + } + + if $step >= 5 and $pacemaker_master { + pacemaker::resource::service { $::cinder::params::api_service : + clone_params => 'interleave=true', + require => Pacemaker::Resource::Ocf['openstack-core'], + } + pacemaker::constraint::base { 'keystone-then-cinder-api-constraint': + constraint_type => 'order', + first_resource => 'openstack-core-clone', + second_resource => "${::cinder::params::api_service}-clone", + first_action => 'start', + second_action => 'start', + require => [Pacemaker::Resource::Ocf['openstack-core'], + Pacemaker::Resource::Service[$::cinder::params::api_service]], + } + } +} diff --git a/manifests/profile/pacemaker/cinder/scheduler.pp b/manifests/profile/pacemaker/cinder/scheduler.pp new file mode 100644 index 0000000..9b79903 --- /dev/null +++ b/manifests/profile/pacemaker/cinder/scheduler.pp @@ -0,0 +1,72 @@ +# Copyright 2016 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# == Class: tripleo::profile::pacemaker::cinder::scheduler +# +# Cinder Scheduler Pacemaker HA profile for tripleo +# +# === Parameters +# +# [*bootstrap_node*] +# (Optional) The hostname of the node responsible for bootstrapping tasks +# Defaults to hiera('bootstrap_nodeid') +# +# [*step*] +# (Optional) The current step in deployment. See tripleo-heat-templates +# for more details. +# Defaults to hiera('step') +# +class tripleo::profile::pacemaker::cinder::scheduler ( + $bootstrap_node = hiera('bootstrap_nodeid'), + $step = hiera('step'), +) { + + Service <| tag == 'cinder-service' |> { + hasrestart => true, + restart => '/bin/true', + start => '/bin/true', + stop => '/bin/true', + } + + if $::hostname == downcase($bootstrap_node) { + $pacemaker_master = true + } else { + $pacemaker_master = false + } + + include ::tripleo::profile::base::cinder::scheduler + + if $step >= 5 and $pacemaker_master { + pacemaker::resource::service { $::cinder::params::scheduler_service : + clone_params => 'interleave=true', + } + pacemaker::constraint::base { 'cinder-api-then-cinder-scheduler-constraint': + constraint_type => 'order', + first_resource => "${::cinder::params::api_service}-clone", + second_resource => "${::cinder::params::scheduler_service}-clone", + first_action => 'start', + second_action => 'start', + require => [Pacemaker::Resource::Service[$::cinder::params::api_service], + Pacemaker::Resource::Service[$::cinder::params::scheduler_service]], + } + pacemaker::constraint::colocation { 'cinder-scheduler-with-cinder-api-colocation': + source => "${::cinder::params::scheduler_service}-clone", + target => "${::cinder::params::api_service}-clone", + score => 'INFINITY', + require => [Pacemaker::Resource::Service[$::cinder::params::api_service], + Pacemaker::Resource::Service[$::cinder::params::scheduler_service]], + } + } + +} diff --git a/manifests/profile/pacemaker/cinder/volume.pp b/manifests/profile/pacemaker/cinder/volume.pp new file mode 100644 index 0000000..a4f251e --- /dev/null +++ b/manifests/profile/pacemaker/cinder/volume.pp @@ -0,0 +1,70 @@ +# Copyright 2016 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# == Class: tripleo::profile::pacemaker::cinder::volume +# +# Cinder Volume Pacemaker HA profile for tripleo +# +# === Parameters +# +# [*bootstrap_node*] +# (Optional) The hostname of the node responsible for bootstrapping tasks +# Defaults to hiera('bootstrap_nodeid') +# +# [*step*] +# (Optional) The current step in deployment. See tripleo-heat-templates +# for more details. +# Defaults to hiera('step') +# +class tripleo::profile::pacemaker::cinder::volume ( + $bootstrap_node = hiera('bootstrap_nodeid'), + $step = hiera('step'), +) { + + Service <| tag == 'cinder-service' |> { + hasrestart => true, + restart => '/bin/true', + start => '/bin/true', + stop => '/bin/true', + } + + if $::hostname == downcase($bootstrap_node) { + $pacemaker_master = true + } else { + $pacemaker_master = false + } + + include ::tripleo::profile::base::cinder::volume + + if $step >= 5 and $pacemaker_master { + pacemaker::resource::service { $::cinder::params::volume_service : } + pacemaker::constraint::base { 'cinder-scheduler-then-cinder-volume-constraint': + constraint_type => 'order', + first_resource => "${::cinder::params::scheduler_service}-clone", + second_resource => $::cinder::params::volume_service, + first_action => 'start', + second_action => 'start', + require => [Pacemaker::Resource::Service[$::cinder::params::scheduler_service], + Pacemaker::Resource::Service[$::cinder::params::volume_service]], + } + pacemaker::constraint::colocation { 'cinder-volume-with-cinder-scheduler-colocation': + source => $::cinder::params::volume_service, + target => "${::cinder::params::scheduler_service}-clone", + score => 'INFINITY', + require => [Pacemaker::Resource::Service[$::cinder::params::scheduler_service], + Pacemaker::Resource::Service[$::cinder::params::volume_service]], + } + } + +} diff --git a/manifests/profile/pacemaker/database/redis.pp b/manifests/profile/pacemaker/database/redis.pp new file mode 100644 index 0000000..9bb96ae --- /dev/null +++ b/manifests/profile/pacemaker/database/redis.pp @@ -0,0 +1,63 @@ +# Copyright 2016 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# == Class: tripleo::profile::pacemaker::database::redis +# +# OpenStack Redis Pacemaker HA profile for tripleo +# +# === Parameters +# +# [*redis_vip*] +# Redis virtual IP +# +# [*bootstrap_node*] +# (Optional) The hostname of the node responsible for bootstrapping tasks +# Defaults to hiera('bootstrap_nodeid') +# +# [*enable_load_balancer*] +# (Optional) Whether load balancing is enabled for this cluster +# Defaults to hiera('enable_load_balancer', true) +# +# [*step*] +# (Optional) The current step in deployment. See tripleo-heat-templates +# for more details. +# Defaults to hiera('step') +# + +class tripleo::profile::pacemaker::database::redis ( + $redis_vip, + $bootstrap_node = hiera('bootstrap_nodeid'), + $enable_load_balancer = hiera('enable_load_balancer', true), + $step = hiera('step'), +) { + if $::hostname == downcase($bootstrap_node) { + $pacemaker_master = true + } else { + $pacemaker_master = false + } + + if $step >= 1 { + include ::redis + } + + if $step >= 2 and $pacemaker_master { + pacemaker::resource::ocf { 'redis': + ocf_agent_name => 'heartbeat:redis', + master_params => '', + meta_params => 'notify=true ordered=true interleave=true', + resource_params => 'wait_last_known_master=true', + require => Class['::redis'], + } + } +} diff --git a/manifests/profile/pacemaker/loadbalancer.pp b/manifests/profile/pacemaker/loadbalancer.pp index 2f41769..24b1596 100644 --- a/manifests/profile/pacemaker/loadbalancer.pp +++ b/manifests/profile/pacemaker/loadbalancer.pp @@ -54,67 +54,45 @@ class tripleo::profile::pacemaker::loadbalancer ( clone_params => true, } - # TODO(emilien): clean-up old parameter references when - # https://review.openstack.org/#/c/320411/ is merged. - if hiera('tripleo::loadbalancer::controller_virtual_ip', undef) { - $control_vip_real = hiera('tripleo::loadbalancer::controller_virtual_ip') - } else { - $control_vip_real = hiera('controller_virtual_ip') - } + $control_vip = hiera('controller_virtual_ip') tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_control_vip': vip_name => 'control', - ip_address => $control_vip_real, + ip_address => $control_vip, } - if hiera('tripleo::loadbalancer::public_virtual_ip', undef) { - $public_vip_real = hiera('tripleo::loadbalancer::public_virtual_ip') - } else { - $public_vip_real = hiera('public_virtual_ip') - } + $public_vip = hiera('public_virtual_ip') tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_public_vip': - ensure => $public_vip_real and $public_vip_real != $control_vip_real, + ensure => $public_vip and $public_vip != $control_vip, vip_name => 'public', - ip_address => $public_vip_real, + ip_address => $public_vip, } $redis_vip = hiera('redis_vip') tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_redis_vip': - ensure => $redis_vip and $redis_vip != $control_vip_real, + ensure => $redis_vip and $redis_vip != $control_vip, vip_name => 'redis', ip_address => $redis_vip, } - if hiera('tripleo::loadbalancer::internal_api_virtual_ip', undef) { - $internal_api_vip_real = hiera('tripleo::loadbalancer::internal_api_virtual_ip') - } else { - $internal_api_vip_real = hiera('internal_api_virtual_ip') - } + $internal_api_vip = hiera('internal_api_virtual_ip') tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_internal_api_vip': - ensure => $internal_api_vip_real and $internal_api_vip_real != $control_vip_real, + ensure => $internal_api_vip and $internal_api_vip != $control_vip, vip_name => 'internal_api', - ip_address => $internal_api_vip_real, + ip_address => $internal_api_vip, } - if hiera('tripleo::loadbalancer::storage_virtual_ip', undef) { - $storage_vip_real = hiera('tripleo::loadbalancer::storage_virtual_ip') - } else { - $storage_vip_real = hiera('storage_virtual_ip') - } + $storage_vip = hiera('storage_virtual_ip') tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_storage_vip': - ensure => $storage_vip_real and $storage_vip_real != $control_vip_real, + ensure => $storage_vip and $storage_vip != $control_vip, vip_name => 'storage', - ip_address => $storage_vip_real, + ip_address => $storage_vip, } - if hiera('tripleo::loadbalancer::storage_mgmt_virtual_ip', undef) { - $storage_mgmt_vip_real = hiera('tripleo::loadbalancer::storage_mgmt_virtual_ip') - } else { - $storage_mgmt_vip_real = hiera('storage_mgmt_virtual_ip') - } + $storage_mgmt_vip = hiera('storage_mgmt_virtual_ip') tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_storage_mgmt_vip': - ensure => $storage_mgmt_vip_real and $storage_mgmt_vip_real != $control_vip_real, + ensure => $storage_mgmt_vip and $storage_mgmt_vip != $control_vip, vip_name => 'storage_mgmt', - ip_address => $storage_mgmt_vip_real, + ip_address => $storage_mgmt_vip, } } diff --git a/manifests/profile/pacemaker/sahara.pp b/manifests/profile/pacemaker/sahara.pp new file mode 100644 index 0000000..04b4edf --- /dev/null +++ b/manifests/profile/pacemaker/sahara.pp @@ -0,0 +1,81 @@ +# Copyright 2016 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# == Class: tripleo::profile::pacemaker::sahara +# +# Sahara Pacemaker HA profile for tripleo +# +# === Parameters +# +# [*bootstrap_node*] +# (Optional) The hostname of the node responsible for bootstrapping tasks +# Defaults to hiera('bootstrap_nodeid') +# +# [*step*] +# (Optional) The current step in deployment. See tripleo-heat-templates +# for more details. +# Defaults to hiera('step') +# +class tripleo::profile::pacemaker::sahara ( + $bootstrap_node = hiera('bootstrap_nodeid'), + $step = hiera('step'), +) { + + Service <| tag == 'sahara-service' |> { + hasrestart => true, + restart => '/bin/true', + start => '/bin/true', + stop => '/bin/true', + } + + if $::hostname == downcase($bootstrap_node) { + $pacemaker_master = true + } else { + $pacemaker_master = false + } + + include ::tripleo::profile::base::sahara-api + class { '::tripleo::profile::base::sahara-engine': + sync_db => $pacemaker_master, + } + + if $step >= 5 and $pacemaker_master { + # Sahara + pacemaker::resource::service { $::sahara::params::api_service_name : + clone_params => 'interleave=true', + require => Pacemaker::Resource::Ocf['openstack-core'], + } + pacemaker::resource::service { $::sahara::params::engine_service_name : + clone_params => 'interleave=true', + } + pacemaker::constraint::base { 'keystone-then-sahara-api-constraint': + constraint_type => 'order', + first_resource => 'openstack-core-clone', + second_resource => "${::sahara::params::api_service_name}-clone", + first_action => 'start', + second_action => 'start', + require => [Pacemaker::Resource::Service[$::sahara::params::api_service_name], + Pacemaker::Resource::Ocf['openstack-core']], + } + pacemaker::constraint::base { 'sahara-api-then-sahara-engine-constraint': + constraint_type => 'order', + first_resource => "${::sahara::params::api_service_name}-clone", + second_resource => "${::sahara::params::engine_service_name}-clone", + first_action => 'start', + second_action => 'start', + require => [Pacemaker::Resource::Service[$::sahara::params::api_service_name], + Pacemaker::Resource::Service[$::sahara::params::engine_service_name]], + } + } +} |