diff options
Diffstat (limited to 'manifests/profile/pacemaker')
28 files changed, 1425 insertions, 38 deletions
diff --git a/manifests/profile/pacemaker/ceilometer.pp b/manifests/profile/pacemaker/ceilometer.pp new file mode 100644 index 0000000..0c21807 --- /dev/null +++ b/manifests/profile/pacemaker/ceilometer.pp @@ -0,0 +1,138 @@ +# 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::ceilometer +# +# Ceilometer 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') +# +# [*sync_db*] +# (Optional) Whether to run db sync +# Defaults to undef +# +class tripleo::profile::pacemaker::ceilometer ( + $bootstrap_node = hiera('bootstrap_nodeid'), + $step = hiera('step'), + $sync_db = true, +) { + + if $::hostname == downcase($bootstrap_node) { + $pacemaker_master = true + } else { + $pacemaker_master = false + } + + include ::tripleo::profile::base::ceilometer + + if $step >= 5 and $pacemaker_master { + $ceilometer_backend = downcase(hiera('ceilometer_backend', 'mongodb')) + case $ceilometer_backend { + /mysql/: { + pacemaker::resource::service { $::ceilometer::params::agent_central_service_name: + clone_params => 'interleave=true', + require => Pacemaker::Resource::Ocf['openstack-core'], + } + } + default: { + pacemaker::resource::service { $::ceilometer::params::agent_central_service_name: + clone_params => 'interleave=true', + require => [Pacemaker::Resource::Ocf['openstack-core'], + Pacemaker::Resource::Service[$::mongodb::params::service_name]], + } + } + } + + if $sync_db { + if $ceilometer_backend == 'mysql' { + class { '::ceilometer::db::mysql': + require => Exec['galera-ready'], + } + } + } + + # NOTE(emilien): the constraints won't live forever here as we're moving to + # pacemaker-lite architecture. + + # Fedora doesn't know `require-all` parameter for constraints yet + if $::operatingsystem == 'Fedora' { + $redis_ceilometer_constraint_params = undef + } else { + $redis_ceilometer_constraint_params = 'require-all=false' + } + pacemaker::constraint::base { 'redis-then-ceilometer-central-constraint': + constraint_type => 'order', + first_resource => 'redis-master', + second_resource => "${::ceilometer::params::agent_central_service_name}-clone", + first_action => 'promote', + second_action => 'start', + constraint_params => $redis_ceilometer_constraint_params, + require => [Pacemaker::Resource::Ocf['redis'], + Pacemaker::Resource::Service[$::ceilometer::params::agent_central_service_name]], + } + pacemaker::constraint::base { 'keystone-then-ceilometer-central-constraint': + constraint_type => 'order', + first_resource => 'openstack-core-clone', + second_resource => "${::ceilometer::params::agent_central_service_name}-clone", + first_action => 'start', + second_action => 'start', + require => [Pacemaker::Resource::Service[$::ceilometer::params::agent_central_service_name], + Pacemaker::Resource::Ocf['openstack-core']], + } + pacemaker::constraint::base { 'keystone-then-ceilometer-notification-constraint': + constraint_type => 'order', + first_resource => 'openstack-core-clone', + second_resource => "${::ceilometer::params::agent_notification_service_name}-clone", + first_action => 'start', + second_action => 'start', + require => [Pacemaker::Resource::Service[$::ceilometer::params::agent_central_service_name], + Pacemaker::Resource::Ocf['openstack-core']], + } + pacemaker::constraint::base { 'ceilometer-central-then-ceilometer-collector-constraint': + constraint_type => 'order', + first_resource => "${::ceilometer::params::agent_central_service_name}-clone", + second_resource => "${::ceilometer::params::collector_service_name}-clone", + first_action => 'start', + second_action => 'start', + require => [Pacemaker::Resource::Service[$::ceilometer::params::agent_central_service_name], + Pacemaker::Resource::Service[$::ceilometer::params::collector_service_name]], + } + pacemaker::constraint::base { 'ceilometer-collector-then-ceilometer-api-constraint': + constraint_type => 'order', + first_resource => "${::ceilometer::params::collector_service_name}-clone", + second_resource => "${::ceilometer::params::api_service_name}-clone", + first_action => 'start', + second_action => 'start', + require => [Pacemaker::Resource::Service[$::ceilometer::params::collector_service_name], + Pacemaker::Resource::Service[$::ceilometer::params::api_service_name]], + } + pacemaker::constraint::colocation { 'ceilometer-api-with-ceilometer-collector-colocation': + source => "${::ceilometer::params::api_service_name}-clone", + target => "${::ceilometer::params::collector_service_name}-clone", + score => 'INFINITY', + require => [Pacemaker::Resource::Service[$::ceilometer::params::api_service_name], + Pacemaker::Resource::Service[$::ceilometer::params::collector_service_name]], + } + } + +} diff --git a/manifests/profile/pacemaker/ceilometer/agent/central.pp b/manifests/profile/pacemaker/ceilometer/agent/central.pp new file mode 100644 index 0000000..e227614 --- /dev/null +++ b/manifests/profile/pacemaker/ceilometer/agent/central.pp @@ -0,0 +1,58 @@ +# 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::ceilometer::agent::central +# +# Ceilometer Central Agent Pacemaker HA profile for tripleo +# +# === Parameters +# +# [*pacemaker_master*] +# (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::ceilometer::agent::central ( + $pacemaker_master = hiera('bootstrap_nodeid'), + $step = hiera('step'), +) { + + include ::ceilometer::params + include ::tripleo::profile::pacemaker::ceilometer + include ::tripleo::profile::base::ceilometer::agent::central + + if $step >= 5 and downcase($::hostname) == $pacemaker_master { + $ceilometer_backend = downcase(hiera('ceilometer_backend', 'mongodb')) + case downcase(hiera('ceilometer_backend')) { + /mysql/: { + pacemaker::resource::service { $::ceilometer::params::agent_central_service_name: + clone_params => 'interleave=true', + require => Pacemaker::Resource::Ocf['openstack-core'], + } + } + default: { + pacemaker::resource::service { $::ceilometer::params::agent_central_service_name: + clone_params => 'interleave=true', + require => [Pacemaker::Resource::Ocf['openstack-core'], + Pacemaker::Resource::Service[$::mongodb::params::service_name]], + } + } + } + } + +} diff --git a/manifests/profile/pacemaker/ceilometer/agent/notification.pp b/manifests/profile/pacemaker/ceilometer/agent/notification.pp new file mode 100644 index 0000000..868bb22 --- /dev/null +++ b/manifests/profile/pacemaker/ceilometer/agent/notification.pp @@ -0,0 +1,45 @@ +# 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::ceilometer::agent::notification +# +# Ceilometer Notification Agent Pacemaker HA profile for tripleo +# +# === Parameters +# +# [*pacemaker_master*] +# (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::ceilometer::agent::notification ( + $pacemaker_master = hiera('bootstrap_nodeid'), + $step = hiera('step'), +) { + + include ::ceilometer::params + include ::tripleo::profile::pacemaker::ceilometer + include ::tripleo::profile::base::ceilometer::agent::notification + + if $step >= 5 and downcase($::hostname) == $pacemaker_master { + pacemaker::resource::service { $::ceilometer::params::agent_notification_service_name : + clone_params => 'interleave=true', + } + } + +} diff --git a/manifests/profile/pacemaker/ceilometer/api.pp b/manifests/profile/pacemaker/ceilometer/api.pp new file mode 100644 index 0000000..cfe103a --- /dev/null +++ b/manifests/profile/pacemaker/ceilometer/api.pp @@ -0,0 +1,52 @@ +# 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::ceilometer::api +# +# Ceilometer API Pacemaker HA profile for tripleo +# +# === Parameters +# +# [*pacemaker_master*] +# (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::ceilometer::api ( + $pacemaker_master = hiera('bootstrap_nodeid'), + $step = hiera('step'), +) { + + include ::ceilometer::params + include ::tripleo::profile::pacemaker::ceilometer + include ::tripleo::profile::base::ceilometer::api + + if $step >= 5 and downcase($::hostname) == $pacemaker_master { + pacemaker::resource::service { $::ceilometer::params::api_service_name : + clone_params => 'interleave=true', + } + pacemaker::constraint::colocation { 'ceilometer-delay-with-ceilometer-api-colocation': + source => 'delay-clone', + target => "${::ceilometer::params::api_service_name}-clone", + score => 'INFINITY', + require => [Pacemaker::Resource::Service[$::ceilometer::params::api_service_name], + Pacemaker::Resource::Ocf['delay']], + } + } + +} diff --git a/manifests/profile/pacemaker/ceilometer/collector.pp b/manifests/profile/pacemaker/ceilometer/collector.pp new file mode 100644 index 0000000..2a838f2 --- /dev/null +++ b/manifests/profile/pacemaker/ceilometer/collector.pp @@ -0,0 +1,57 @@ +# 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::ceilometer::collector +# +# Ceilometer Collector Pacemaker HA profile for tripleo +# +# === Parameters +# +# [*pacemaker_master*] +# (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') +# +# [*sync_db*] +# (Optional) Whether to run db sync +# Defaults to undef +# +class tripleo::profile::pacemaker::ceilometer::collector ( + $pacemaker_master = hiera('bootstrap_nodeid'), + $step = hiera('step'), + $sync_db = true, +) { + + include ::ceilometer::params + include ::tripleo::profile::pacemaker::ceilometer + + class { '::tripleo::profile::base::ceilometer::collector': + sync_db => (downcase($::hostname) == $pacemaker_master), + } + + if $step >= 5 and downcase($::hostname) == $pacemaker_master { + $ceilometer_backend = downcase(hiera('ceilometer_backend', 'mongodb')) + if $ceilometer_backend == 'mysql' { + Exec<| title == 'galera-ready'|> -> Class['ceilometer::db::mysql'] + } + pacemaker::resource::service { $::ceilometer::params::collector_service_name : + clone_params => 'interleave=true', + } + } + +} 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/mongodb.pp b/manifests/profile/pacemaker/database/mongodb.pp new file mode 100644 index 0000000..15c84d7 --- /dev/null +++ b/manifests/profile/pacemaker/database/mongodb.pp @@ -0,0 +1,74 @@ +# 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::mongodb +# +# Mongodb Pacemaker HA profile for tripleo +# +# === Parameters +# +# [*mongodb_replset*] +# Mongodb replicaset name +# +# [*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::database::mongodb ( + $mongodb_replset, + $bootstrap_node = hiera('bootstrap_nodeid'), + $step = hiera('step'), +) { + + if $step >= 1 { + include ::mongodb::globals + include ::mongodb::client + include ::mongodb::server + } + + if $step >= 2 { + + include ::tripleo::profile::base::database::mongodbcommon + + if $::hostname == downcase($bootstrap_node) { + $pacemaker_master = true + } else { + $pacemaker_master = false + } + + if $pacemaker_master { + pacemaker::resource::service { $::mongodb::params::service_name : + op_params => 'start timeout=370s stop timeout=200s', + clone_params => true, + require => Class['::mongodb::server'], + } + # NOTE (spredzy) : The replset can only be run + # once all the nodes have joined the cluster. + tripleo::profile::pacemaker::database::mongodbvalidator { + $tripleo::profile::base::database::mongodbcommon::mongodb_node_ips : + port => $tripleo::profile::base::database::mongodbcommon::port, + require => Pacemaker::Resource::Service[$::mongodb::params::service_name], + before => Mongodb_replset[$mongodb_replset], + } + mongodb_replset { $mongodb_replset : + members => $tripleo::profile::base::database::mongodbcommon::mongo_node_ips_with_port_nobr, + } + } + } +} diff --git a/manifests/profile/pacemaker/database/mongodbvalidator.pp b/manifests/profile/pacemaker/database/mongodbvalidator.pp new file mode 100644 index 0000000..95d3bd7 --- /dev/null +++ b/manifests/profile/pacemaker/database/mongodbvalidator.pp @@ -0,0 +1,37 @@ +# 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::mongodb::conn_validator +# +# Connection validator for a node that serves MongoDB. This is done to be able +# to iterate through the different servers in a more seamless way. +# +# === Parameters +# +# [*title*] +# the title or namevar of the resource will be used as the server of the +# actual mongodb_conn_validator. +# +# [*port*] +# The port in which the MongoDB server is listening on. +# +define tripleo::profile::pacemaker::database::mongodbvalidator( + $port, +) { + mongodb_conn_validator { "${title}_conn_validator" : + server => $title, + port => $port, + timeout => '600', + } +} 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/haproxy.pp index 926b482..a7aca58 100644 --- a/manifests/profile/pacemaker/loadbalancer.pp +++ b/manifests/profile/pacemaker/haproxy.pp @@ -12,9 +12,9 @@ # License for the specific language governing permissions and limitations # under the License. # -# == Class: tripleo::profile::pacemaker::loadbalancer +# == Class: tripleo::profile::pacemaker::haproxy # -# Loadbalancer Pacemaker HA profile for tripleo +# HAproxy with Pacemaker HA profile for tripleo # # === Parameters # @@ -31,13 +31,13 @@ # (Optional) Whether load balancing is enabled for this cluster # Defaults to hiera('enable_load_balancer', true) # -class tripleo::profile::pacemaker::loadbalancer ( +class tripleo::profile::pacemaker::haproxy ( $bootstrap_node = hiera('bootstrap_nodeid'), $step = hiera('step'), $enable_load_balancer = hiera('enable_load_balancer', true) ) { - include ::tripleo::profile::base::loadbalancer + include ::tripleo::profile::base::haproxy if $::hostname == downcase($bootstrap_node) { $pacemaker_master = true @@ -46,7 +46,7 @@ class tripleo::profile::pacemaker::loadbalancer ( } if $step >= 2 and $pacemaker_master and $enable_load_balancer { - # FIXME: we should not have to access tripleo::loadbalancer class + # FIXME: we should not have to access tripleo::haproxy class # parameters here to configure pacemaker VIPs. The configuration # of pacemaker VIPs could move into puppet-tripleo or we should # make use of less specific hiera parameters here for the settings. @@ -54,13 +54,13 @@ class tripleo::profile::pacemaker::loadbalancer ( clone_params => true, } - $control_vip = hiera('tripleo::loadbalancer::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, } - $public_vip = hiera('tripleo::loadbalancer::public_virtual_ip') + $public_vip = hiera('public_virtual_ip') tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_public_vip': ensure => $public_vip and $public_vip != $control_vip, vip_name => 'public', @@ -74,21 +74,21 @@ class tripleo::profile::pacemaker::loadbalancer ( ip_address => $redis_vip, } - $internal_api_vip = hiera('tripleo::loadbalancer::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 and $internal_api_vip != $control_vip, vip_name => 'internal_api', ip_address => $internal_api_vip, } - $storage_vip = hiera('tripleo::loadbalancer::storage_virtual_ip') + $storage_vip = hiera('storage_virtual_ip') tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_storage_vip': ensure => $storage_vip and $storage_vip != $control_vip, vip_name => 'storage', ip_address => $storage_vip, } - $storage_mgmt_vip = hiera('tripleo::loadbalancer::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 and $storage_mgmt_vip != $control_vip, vip_name => 'storage_mgmt', diff --git a/manifests/profile/pacemaker/keystone.pp b/manifests/profile/pacemaker/keystone.pp index 42c44d4..497d6f3 100644 --- a/manifests/profile/pacemaker/keystone.pp +++ b/manifests/profile/pacemaker/keystone.pp @@ -59,10 +59,9 @@ class tripleo::profile::pacemaker::keystone ( } class { '::tripleo::profile::base::keystone': - sync_db => $pacemaker_master, - bootstrap_master => $pacemaker_master, - manage_roles => $manage_roles, - manage_endpoint => $manage_roles + sync_db => $pacemaker_master, + manage_roles => $manage_roles, + manage_endpoint => $manage_roles } if $step >= 5 and $pacemaker_master and $enable_load_balancer { diff --git a/manifests/profile/pacemaker/manila.pp b/manifests/profile/pacemaker/manila.pp new file mode 100644 index 0000000..37cab9f --- /dev/null +++ b/manifests/profile/pacemaker/manila.pp @@ -0,0 +1,162 @@ +# 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::manila +# +# Manila 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') +# +# [*manila_generic_enable*] +# (Optional) Enable the generic backend. +# Defaults to hiera('manila_generic_enable_backend', 'false') +# +# [*driver_handles_share_servers*] +# (Optional) +# Defaults to hiera('manila::backend::generic::driver_handles_share_servers') +# +# [*smb_template_config_path*] +# (Optional) +# Defaults to hiera('manila::backend::generic::smb_template_config_path') +# +# [*volume_name_template*] +# (Optional) +# Defaults to hiera('manila::backend::generic::volume_name_template') + +# [*volume_snapshot_name_template*] +# (Optional) +# Defaults to hiera('manila::backend::generic::volume_snapshot_name_template') +# +# [*share_mount_path*] +# (Optional) +# Defaults to hiera('manila::backend::generic::share_mount_path') +# +# [*max_time_to_create_volume*] +# (Optional) +# Defaults to hiera('manila::backend::generic::max_time_to_create_volume') +# +# [*max_time_to_attach*] +# (Optional) +# Defaults to hiera('manila::backend::generic::max_time_to_attach') +# +# [*service_instance_smb_config_path*] +# (Optional) +# Defaults to downcase(hiera('manila::backend::generic::service_instance_smb_config_path')) +# +# [*share_volume_fstype*] +# (Optional) +# Defaults to hiera('manila::backend::generic::share_volume_fstype') +# +# [*cinder_volume_type*] +# (Optional) +# Defaults to hiera('manila::backend::generic::cinder_volume_type', '') +# +# [*service_instance_user*] +# (Optional) +# Defaults to hiera('manila::service_instance::service_instance_user') + +# [*service_instance_password*] +# (Optional) +# Defaults to hiera('manila::service_instance::service_instance_password') + +# [*service_instance_flavor_id*] +# (Optional) +# Defaults to hiera('manila::service_instance::service_instance_flavor_id') +# +class tripleo::profile::pacemaker::manila ( + $bootstrap_node = hiera('bootstrap_nodeid'), + $step = hiera('step'), + $manila_generic_enable = hiera('manila_generic_enable_backend', false), + $driver_handles_share_servers = hiera('manila::backend::generic::driver_handles_share_servers'), + $smb_template_config_path = hiera('manila::backend::generic::smb_template_config_path'), + $volume_name_template = hiera('manila::backend::generic::volume_name_template'), + $volume_snapshot_name_template = hiera('manila::backend::generic::volume_snapshot_name_template'), + $share_mount_path = hiera('manila::backend::generic::share_mount_path'), + $max_time_to_create_volume = hiera('manila::backend::generic::max_time_to_create_volume'), + $max_time_to_attach = hiera('manila::backend::generic::max_time_to_attach'), + $service_instance_smb_config_path = hiera('manila::backend::generic::service_instance_smb_config_path'), + $share_volume_fstype = hiera('manila::backend::generic::share_volume_fstype'), + $cinder_volume_type = hiera('manila::backend::generic::cinder_volume_type', ''), + $service_instance_user = hiera('manila::service_instance::service_instance_user'), + $service_instance_password = hiera('manila::service_instance::service_instance_password'), + $service_instance_flavor_id = hiera('manila::service_instance::service_instance_flavor_id'), +) { + + if $::hostname == downcase($bootstrap_node) { + $pacemaker_master = true + } else { + $pacemaker_master = false + } + + # make it so puppet can't restart the manila-share service, since that is + # the only pacemaker managed one + Service <| tag == 'manila-share' |> { + hasrestart => true, + restart => '/bin/true', + start => '/bin/true', + stop => '/bin/true', + } + + if $step >= 4 { + include ::tripleo::profile::base::manila::api + include ::tripleo::profile::base::manila::scheduler + include ::tripleo::profile::base::manila::share + + $manila_generic_enable = hiera('manila_generic_enable_backend', false) + if $manila_generic_enable { + $manila_generic_backend = hiera('manila::backend::generic::title') + manila::backend::generic { $manila_generic_backend : + driver_handles_share_servers => $driver_handles_share_servers, + smb_template_config_path => $smb_template_config_path, + volume_name_template => $volume_name_template , + volume_snapshot_name_template => $volume_snapshot_name_template, + share_mount_path => $share_mount_path, + max_time_to_create_volume => $max_time_to_create_volume, + max_time_to_attach => $max_time_to_attach, + service_instance_smb_config_path => $service_instance_smb_config_path, + share_volume_fstype => $share_volume_fstype, + cinder_volume_type => $cinder_volume_type, + } + + manila_config { + "${manila_generic_backend}/service_instance_user": value => $service_instance_user; + "${manila_generic_backend}/service_instance_password": value => $service_instance_password; + "${manila_generic_backend}/service_instance_flavor_id": value => $service_instance_flavor_id; + } + + include ::manila::volume::cinder + } + + $manila_enabled_backends = delete_undef_values([$manila_generic_backend]) + class { '::manila::backends' : + enabled_share_backends => $manila_enabled_backends, + } + } + + if $step >= 5 and $pacemaker_master { + + # only manila-share is pacemaker managed, and in a/p + pacemaker::resource::service { $::manila::params::share_service : } + + } +} diff --git a/manifests/profile/pacemaker/neutron.pp b/manifests/profile/pacemaker/neutron.pp index 03ccbc3..2af53dc 100644 --- a/manifests/profile/pacemaker/neutron.pp +++ b/manifests/profile/pacemaker/neutron.pp @@ -61,9 +61,12 @@ class tripleo::profile::pacemaker::neutron ( stop => '/bin/true', } + class { '::tripleo::profile::base::neutron': + sync_db => ($::hostname == downcase($pacemaker_master)), + } + if $step >= 4 { include ::neutron::params - include ::tripleo::profile::base::neutron # To be removed when puppet-oslo comes into service neutron_config { diff --git a/manifests/profile/pacemaker/neutron/ml2.pp b/manifests/profile/pacemaker/neutron/ml2.pp index 6c6e580..ab5a219 100644 --- a/manifests/profile/pacemaker/neutron/ml2.pp +++ b/manifests/profile/pacemaker/neutron/ml2.pp @@ -18,8 +18,21 @@ # # === Parameters # -class tripleo::profile::pacemaker::neutron::ml2 { +# [*pacemaker_master*] +# (Optional) The hostname of the pacemaker master +# Defaults to hiera('bootstrap_nodeid') +# +class tripleo::profile::pacemaker::neutron::ml2 ( + $pacemaker_master = hiera('bootstrap_nodeid'), +) { + + warning('This class is going is deprecated and will be removed very soon, replaced by tripleo::profile::pacemaker::neutron::plugins::ml2.') + include ::neutron::params include ::tripleo::profile::pacemaker::neutron - include ::tripleo::profile::base::neutron::ml2 + + class { '::tripleo::profile::base::neutron::plugins::ml2': + sync_db => ($::hostname == downcase($pacemaker_master)) + } + } diff --git a/manifests/profile/pacemaker/neutron/plugins/ml2.pp b/manifests/profile/pacemaker/neutron/plugins/ml2.pp new file mode 100644 index 0000000..5ec363b --- /dev/null +++ b/manifests/profile/pacemaker/neutron/plugins/ml2.pp @@ -0,0 +1,36 @@ +# 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::neutron::plugins::ml2 +# +# Neutron ML2 driver Pacemaker HA profile for tripleo +# +# === Parameters +# +# [*pacemaker_master*] +# (Optional) The hostname of the pacemaker master +# Defaults to hiera('bootstrap_nodeid') +# +class tripleo::profile::pacemaker::neutron::plugins::ml2 ( + $pacemaker_master = hiera('bootstrap_nodeid'), +) { + + include ::neutron::params + include ::tripleo::profile::pacemaker::neutron + + class { '::tripleo::profile::base::neutron::plugins::ml2': + sync_db => ($::hostname == downcase($pacemaker_master)) + } + +} diff --git a/manifests/profile/pacemaker/neutron/plugins/nuage.pp b/manifests/profile/pacemaker/neutron/plugins/nuage.pp new file mode 100644 index 0000000..6b38884 --- /dev/null +++ b/manifests/profile/pacemaker/neutron/plugins/nuage.pp @@ -0,0 +1,33 @@ +# 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::neutron::plugins::nuage +# +# Nuage Neutron profile for tripleo pacemaker +# +# === Parameters +# +# [*pacemaker_master*] +# (Optional) The hostname of the pacemaker master +# Defaults to hiera('bootstrap_nodeid') +# +class tripleo::profile::pacemaker::neutron::plugins::nuage ( + $pacemaker_master = hiera('bootstrap_nodeid'), +) { + + class { '::tripleo::profile::base::neutron::plugins::nuage': + sync_db => ($::hostname == downcase($pacemaker_master)) + } + +} diff --git a/manifests/profile/pacemaker/neutron/plugins/opencontrail.pp b/manifests/profile/pacemaker/neutron/plugins/opencontrail.pp new file mode 100644 index 0000000..32564f4 --- /dev/null +++ b/manifests/profile/pacemaker/neutron/plugins/opencontrail.pp @@ -0,0 +1,33 @@ +# 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::neutron::plugins::opencontrail +# +# Opencontrail Neutron profile for tripleo pacemaker +# +# === Parameters +# +# [*pacemaker_master*] +# (Optional) The hostname of the pacemaker master +# Defaults to hiera('bootstrap_nodeid') +# +class tripleo::profile::pacemaker::neutron::plugins::opencontrail ( + $pacemaker_master = hiera('bootstrap_nodeid'), +) { + + class { '::tripleo::profile::base::neutron::plugins::opencontrail': + sync_db => ($::hostname == downcase($pacemaker_master)) + } + +} diff --git a/manifests/profile/pacemaker/neutron/plugins/plumgrid.pp b/manifests/profile/pacemaker/neutron/plugins/plumgrid.pp new file mode 100644 index 0000000..1f2b32a --- /dev/null +++ b/manifests/profile/pacemaker/neutron/plugins/plumgrid.pp @@ -0,0 +1,33 @@ +# Copyright 2016 PLUMgrid, 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::neutron::plugins::plumgrid +# +# PLUMgrid Neutron profile for tripleo pacemaker +# +# === Parameters +# +# [*pacemaker_master*] +# (Optional) The hostname of the pacemaker master +# Defaults to hiera('bootstrap_nodeid') +# +class tripleo::profile::pacemaker::neutron::plugins::plumgrid ( + $pacemaker_master = hiera('bootstrap_nodeid'), +) { + + class { '::tripleo::profile::base::neutron::plugins::plumgrid': + sync_db => ($::hostname == downcase($pacemaker_master)) + } + +} diff --git a/manifests/profile/pacemaker/neutron/server.pp b/manifests/profile/pacemaker/neutron/server.pp index 83e8a2a..0bad1b9 100644 --- a/manifests/profile/pacemaker/neutron/server.pp +++ b/manifests/profile/pacemaker/neutron/server.pp @@ -23,34 +23,27 @@ # Defaults to hiera('bootstrap_nodeid') # # [*step*] -# (Optional) The current step in deployment. See tripleo-heat-templates -# for more details. -# Defaults to hiera('step') +# (Optional) The current step in deployment. See tripleo-heat-templates +# for more details. +# Defaults to hiera('step') # class tripleo::profile::pacemaker::neutron::server ( $pacemaker_master = hiera('bootstrap_nodeid'), - $step = hiera('step'), + $step = hiera('step'), ) { + include ::neutron::params include ::tripleo::profile::pacemaker::neutron - if $step >= 5 { - - class { '::tripleo::profile::base::neutron::server': - sync_db => ($::hostname == downcase($pacemaker_master)), - } - - if ($::hostname == downcase($pacemaker_master)) { - pacemaker::constraint::base { 'keystone-to-neutron-server-constraint': - constraint_type => 'order', - first_resource => 'openstack-core-clone', - second_resource => "${::neutron::params::server_service}-clone", - first_action => 'start', - second_action => 'start', - require => [Pacemaker::Resource::Ocf['openstack-core'], - Pacemaker::Resource::Service[$::neutron::params::server_service]], - } - } + $sync_db = ($::hostname == downcase($pacemaker_master)) + if $step >= 2 and $sync_db { + include ::neutron::db::mysql + Exec<| title == 'galera-ready'|> -> Class['neutron::db::mysql'] + } + if $step >= 4 or ( $step >= 3 and $sync_db ) { + include ::neutron::server::notifications + include ::neutron::server } + } diff --git a/manifests/profile/pacemaker/nova.pp b/manifests/profile/pacemaker/nova.pp new file mode 100644 index 0000000..b6e6cba --- /dev/null +++ b/manifests/profile/pacemaker/nova.pp @@ -0,0 +1,40 @@ +# 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::nova +# +# Nova base with Pacemaker profile for tripleo +# +# === Parameters +# +# [*step*] +# (Optional) The step in the deployment +# Defaults to hiera('step') +# +class tripleo::profile::pacemaker::nova ( + $step = hiera('step'), +) { + + Service <| + tag == 'nova-service' + |> { + hasrestart => true, + restart => '/bin/true', + start => '/bin/true', + stop => '/bin/true', + } + + include ::tripleo::profile::base::nova + +} diff --git a/manifests/profile/pacemaker/nova/api.pp b/manifests/profile/pacemaker/nova/api.pp new file mode 100644 index 0000000..5d8e11f --- /dev/null +++ b/manifests/profile/pacemaker/nova/api.pp @@ -0,0 +1,48 @@ +# 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::nova::api +# +# Nova API with Pacemaker profile for tripleo +# +# === Parameters +# +# [*step*] +# (Optional) The current step in deployment. See tripleo-heat-templates +# for more details. +# Defaults to hiera('step') +# +# [*pacemaker_master*] +# (Optional) The hostname of the pacemaker master +# Defaults to downcase(hiera('bootstrap_nodeid')) +# +class tripleo::profile::pacemaker::nova::api ( + $step = hiera('step'), + $pacemaker_master = downcase(hiera('bootstrap_nodeid')), +) { + + include ::nova::params + include ::tripleo::profile::pacemaker::nova + + class { '::tripleo::profile::base::nova::api': + sync_db => (downcase($::hostname) == $pacemaker_master), + } + + if $step >= 5 and downcase($::hostname) == $pacemaker_master { + pacemaker::resource::service { $::nova::params::api_service_name: + clone_params => 'interleave=true', + } + } + +} diff --git a/manifests/profile/pacemaker/nova/conductor.pp b/manifests/profile/pacemaker/nova/conductor.pp new file mode 100644 index 0000000..76dc462 --- /dev/null +++ b/manifests/profile/pacemaker/nova/conductor.pp @@ -0,0 +1,45 @@ +# 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::nova::conductor +# +# Nova Conductor with Pacemaker profile for tripleo +# +# === Parameters +# +# [*step*] +# (Optional) The current step in deployment. See tripleo-heat-templates +# for more details. +# Defaults to hiera('step') +# +# [*pacemaker_master*] +# (Optional) The hostname of the pacemaker master +# Defaults to hiera('bootstrap_nodeid') +# +class tripleo::profile::pacemaker::nova::conductor ( + $step = hiera('step'), + $pacemaker_master = hiera('bootstrap_nodeid'), +) { + + include ::nova::params + include ::tripleo::profile::pacemaker::nova + include ::tripleo::profile::base::nova::conductor + + if $step >= 5 and downcase($::hostname) == $pacemaker_master { + pacemaker::resource::service { $::nova::params::conductor_service_name: + clone_params => 'interleave=true', + } + } + +} diff --git a/manifests/profile/pacemaker/nova/consoleauth.pp b/manifests/profile/pacemaker/nova/consoleauth.pp new file mode 100644 index 0000000..54f17b7 --- /dev/null +++ b/manifests/profile/pacemaker/nova/consoleauth.pp @@ -0,0 +1,45 @@ +# 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::nova::consoleauth +# +# Nova Consoleauth with Pacemaker profile for tripleo +# +# === Parameters +# +# [*step*] +# (Optional) The current step in deployment. See tripleo-heat-templates +# for more details. +# Defaults to hiera('step') +# +# [*pacemaker_master*] +# (Optional) The hostname of the pacemaker master +# Defaults to hiera('bootstrap_nodeid') +# +class tripleo::profile::pacemaker::nova::consoleauth ( + $step = hiera('step'), + $pacemaker_master = hiera('bootstrap_nodeid'), +) { + + include ::nova::params + include ::tripleo::profile::pacemaker::nova + include ::tripleo::profile::base::nova::consoleauth + + if $step >= 5 and downcase($::hostname) == $pacemaker_master { + pacemaker::resource::service { $::nova::params::consoleauth_service_name: + clone_params => 'interleave=true', + } + } + +} diff --git a/manifests/profile/pacemaker/nova/scheduler.pp b/manifests/profile/pacemaker/nova/scheduler.pp new file mode 100644 index 0000000..6516394 --- /dev/null +++ b/manifests/profile/pacemaker/nova/scheduler.pp @@ -0,0 +1,45 @@ +# 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::nova::scheduler +# +# Nova Scheduler with Pacemaker profile for tripleo +# +# === Parameters +# +# [*step*] +# (Optional) The current step in deployment. See tripleo-heat-templates +# for more details. +# Defaults to hiera('step') +# +# [*pacemaker_master*] +# (Optional) The hostname of the pacemaker master +# Defaults to hiera('bootstrap_nodeid') +# +class tripleo::profile::pacemaker::nova::scheduler ( + $step = hiera('step'), + $pacemaker_master = hiera('bootstrap_nodeid'), +) { + + include ::nova::params + include ::tripleo::profile::pacemaker::nova + include ::tripleo::profile::base::nova::scheduler + + if $step >= 5 and downcase($::hostname) == $pacemaker_master { + pacemaker::resource::service { $::nova::params::scheduler_service_name: + clone_params => 'interleave=true', + } + } + +} diff --git a/manifests/profile/pacemaker/nova/vncproxy.pp b/manifests/profile/pacemaker/nova/vncproxy.pp new file mode 100644 index 0000000..7f7d095 --- /dev/null +++ b/manifests/profile/pacemaker/nova/vncproxy.pp @@ -0,0 +1,45 @@ +# 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::nova::vncproxy +# +# Nova vncproxy with Pacemaker profile for tripleo +# +# === Parameters +# +# [*step*] +# (Optional) The current step in deployment. See tripleo-heat-templates +# for more details. +# Defaults to hiera('step') +# +# [*pacemaker_master*] +# (Optional) The hostname of the pacemaker master +# Defaults to hiera('bootstrap_nodeid') +# +class tripleo::profile::pacemaker::nova::vncproxy ( + $step = hiera('step'), + $pacemaker_master = hiera('bootstrap_nodeid'), +) { + + include ::nova::params + include ::tripleo::profile::pacemaker::nova + include ::tripleo::profile::base::nova::vncproxy + + if $step >= 5 and downcase($::hostname) == $pacemaker_master { + pacemaker::resource::service { $::nova::params::vncproxy_service_name: + clone_params => 'interleave=true', + } + } + +} 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]], + } + } +} |