Last active
August 29, 2015 14:06
-
-
Save tfitch/0d3e7b610471d2f175b3 to your computer and use it in GitHub Desktop.
recipe for MongoDB Replica Set Primary node
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# some stuff was probably above here | |
# chef_environment might look redundant, but it will find machine in the same environment this machine is configured for | |
secondaries = search(:node, "role:mongodb-secondary AND chef_environment:#{node.chef_environment} AND mongodb_replica_set:#{node.mongodb.replica_set}") | |
# pass them in to the template below | |
template '/apps/mongodb/conf/replicaset.js' do | |
owner 'mongodb' | |
group 'users' | |
mode '0755' | |
action :create | |
variables({ | |
:replicaset => node.mongodb.replica_set, | |
:secondaries => secondaries | |
}) | |
end | |
execute "mongodb-config" do | |
command "/apps/mongodb/bin/mongo localhost:27017/test /apps/mongodb/conf/replicaset.js" | |
action :run | |
retries 6 | |
retry_delay 10 | |
end | |
# and something is probably below here, but maybe not for the primary |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment