summaryrefslogtreecommitdiffstats
path: root/puppet
diff options
context:
space:
mode:
authorYanis Guenane <yanis.guenane@enovance.com>2015-04-28 14:52:49 +0200
committerYanis Guenane <yanis.guenane@enovance.com>2015-05-05 09:55:05 +0200
commit217f89eadb7f432f78c4a5c03a8b7c9cd237162d (patch)
tree07a7895c123544940d7d94c5d04da02a3304f7e2 /puppet
parent4d4a544c26ffca49a47a90d511996d3bdb2c1d06 (diff)
Add MongoDB as a Pacemaker resource when EnablePacemaker
This commit allows one to configure MongoDB as a pacemaker resource when EnablePacemaker is set to true Change-Id: Iedfba3eb851442d0ca3b8c0a7163a63285ab6071
Diffstat (limited to 'puppet')
-rw-r--r--puppet/manifests/overcloud_controller.pp33
1 files changed, 32 insertions, 1 deletions
diff --git a/puppet/manifests/overcloud_controller.pp b/puppet/manifests/overcloud_controller.pp
index d78f2d07..7ec2b1ad 100644
--- a/puppet/manifests/overcloud_controller.pp
+++ b/puppet/manifests/overcloud_controller.pp
@@ -69,6 +69,8 @@ if hiera('step') >= 1 {
clone => true,
}
}
+
+ Class['::pacemaker::corosync'] -> Pacemaker::Resource::Systemd <| |>
}
}
@@ -82,7 +84,16 @@ if hiera('step') >= 2 {
# MongoDB
if downcase(hiera('ceilometer_backend')) == 'mongodb' {
include ::mongodb::globals
- include ::mongodb::server
+
+ if $enable_pacemaker {
+ $mongodb_service_ensure = undef
+ } else {
+ $mongodb_service_ensure = 'running'
+ }
+
+ class {'::mongodb::server' :
+ service_ensure => $mongodb_service_ensure,
+ }
$mongo_node_ips = split(hiera('mongo_node_ips'), ',')
$mongo_node_ips_with_port = suffix($mongo_node_ips, ':27017')
$mongo_node_string = join($mongo_node_ips_with_port, ',')
@@ -90,6 +101,26 @@ if hiera('step') >= 2 {
$mongodb_replset = hiera('mongodb::server::replset')
$ceilometer_mongodb_conn_string = "mongodb://${mongo_node_string}/ceilometer?replicaSet=${mongodb_replset}"
if downcase(hiera('bootstrap_nodeid')) == $::hostname {
+
+ if $enable_pacemaker {
+ pacemaker::resource::systemd { 'mongod' :
+ options => "op start timeout=120s",
+ clone => true,
+ before => Exec['mongodb-ready'],
+ }
+ # NOTE (spredzy) : The replset can only be run
+ # once all the nodes have joined the cluster.
+ $mongodb_cluster_ready_command = join(suffix(prefix($mongo_node_ips, '/bin/nc -w1 '), ' 27017 < /dev/null'), ' && ')
+ exec { 'mongodb-ready' :
+ command => $mongodb_cluster_ready_command,
+ timeout => 600,
+ tries => 60,
+ try_sleep => 10,
+ before => Mongodb_replset[$mongodb_replset],
+ }
+
+ }
+
mongodb_replset { $mongodb_replset :
members => $mongo_node_ips_with_port,
}