Commit e650a267 by Kevin Falcone

Refactor of role to handle initialization and reruns

Previously on this branch, it would attempt to create a superuser and
initialize the replica set after the local host exemption had passed
(once a mongod is started with a keyfile and the replicationSetName
 config file option or --replSet command line argument, you can't create
 users using the localhost exemption anymore ).

This necesarily complicates the logic and requires us to track if we're
initializing a replica set or not (with facts) and to template out
/etc/mongod.conf twice in the initialization case.

Further modifications to the replica set can be run against all the
members and will install mongo on new machines while updating the
replica set on the old machines.  With a further commit on this branch,
we can avoid needlessly restarting mongo on all machines in the cluster.

When we run this on an existing cluster, this stops and starts mongo for
all machines it is run against.  We can't rely on the notify: since that
happens at the end of the play and during initial cluster setup, we need
to restart and pick up the changed config.

Try to stick sensible tags on things

Ensure mongo restarts on the cluster key file change

Add a few playbook notes about common operations
parent 7eaaa323
# Manages a mongo cluster.
# To set up a new mongo cluster, make sure you've configured MONGO_RS_CONFIG
# as used by mongo_replica_set in the mongo_3_0 role.
#
# If you are initializing a cluster, your command might look like:
# ansible-playbook mongo_3_0.yml -i 10.1.1.1,10.2.2.2,10.3.3.3 -e@/path/to/edx.yml -e@/path/to/ed.yml
# If you just want to deploy an updated replica set config, you can run
# ansible-playbook mongo_3_0.yml -i any-cluster-ip -e@/path/to/edx.yml -e@/path/to/ed.yml --tags configure_replica_set
#
# ADDING A NEW CLUSTER MEMBER
# If you are adding a member to a cluster, you must be sure that the new machine is not first in your inventory
# ansible-playbook mongo_3_0.yml -i 10.1.1.1,10.2.2.2,new-machine-ip -e@/path/to/edx.yml -e@/path/to/ed.yml
- name: Deploy MongoDB
hosts: all
sudo: True
......
......@@ -29,7 +29,7 @@ systemLog:
{% endif %}
logRotate: {{ mongo_logrotate }}
{% if MONGO_CLUSTERED %}
{% if MONGO_CLUSTERED and not skip_replica_set %}
replication:
replSetName: {{ MONGO_REPL_SET }}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment