From: Yanis Guenane Date: Wed, 15 Apr 2015 12:41:25 +0000 (+0200) Subject: Fix MongoDB setup on nonha setup X-Git-Tag: opnfv-6.0.0~2618 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=e202d2dbf578fd6842e9fd16389dc61729995cc0;p=apex-tripleo-heat-templates.git Fix MongoDB setup on nonha setup Currently a replset parameter is set in mongodb.conf no matter if we are in a ha or nonha setup. This install fine, but on a nonha setup it prevents any program from using MongoDB, since no replset has been initialized. It generates the following error when a program tries to use it : not master and slaveOk=false To prevent this issue a replicatset is initialized in both ha and nonha setup, this way if another MongoDB node is added to the pool, it will be able to attach automatically Change-Id: I65e3f1ad35cb0cd31f6771444a0cffdf7569222f --- diff --git a/puppet/manifests/overcloud_controller.pp b/puppet/manifests/overcloud_controller.pp index 0541fa4e..9ec224a9 100644 --- a/puppet/manifests/overcloud_controller.pp +++ b/puppet/manifests/overcloud_controller.pp @@ -45,12 +45,10 @@ if hiera('step') >= 2 { $mongo_node_ips = split(downcase(hiera('mongo_node_ips')), ',') $mongo_node_ips_with_port = suffix($mongo_node_ips, ':27017') - if count($mongo_node_ips) > 1 { - if downcase($::hostname) == hiera('bootstrap_nodeid') { - $mongodb_replset = hiera('mongodb::server::replset') - mongodb_replset { $mongodb_replset : - members => $mongo_node_ips_with_port, - } + $mongodb_replset = hiera('mongodb::server::replset') + if downcase(hiera('bootstrap_nodeid')) == $::hostname { + mongodb_replset { $mongodb_replset : + members => $mongo_node_ips_with_port, } }