Commit ecac0d8e by Kevin Falcone

Add SKIP_PRIMARY to allow partial cluster upgrades

Improve docs.
parent 8dd4e8fb
# Upgrades the hidden secondary in a mongo cluster if one exists # Upgrades a full mongo cluster, starting with the hidden members, then the
# # secondary, and finally steps down the primary and upgrades it. It checks along
# This is useful for using the hidden secondary to sniff out any problems with # the way for a healthy cluster, failing if that is not true.
# your point upgrade before you upgrade your primary/secondary servers using the
# mongo_rolling_upgrade.yml play
# #
# This play expects to have access to a config file where MONGO_RS_CONFIG, as described # This play expects to have access to a config file where MONGO_RS_CONFIG, as described
# in the mongo_3_0 role, is defined, as well as MONGO_ADMIN_USER and MONGO_ADMIN_PASSWORD. # in the mongo_3_0 role, is defined, as well as MONGO_ADMIN_USER and MONGO_ADMIN_PASSWORD.
# #
# ansible-playbook -i 127.0.0.1, mongo_upgrade_hidden_secondaries.yml -e@/path/to/config-file.yml # ansible-playbook -i 127.0.0.1, mongo_rolling_upgrade.yml -e@/path/to/config-file.yml
# #
# This play uses MONGO_RS_CONFIG to find a host to connect to and fetch replset config and build an # This play uses MONGO_RS_CONFIG to find a host to connect to and fetch replset config and build an
# inventory, so you can just target localhost. # inventory, so you can just target localhost.
# #
# If there are no hidden secondaries, the 'Upgrade hidden members' task will just skip. # If there are no hidden secondaries, the 'Upgrade hidden members' task block will just skip.
#
# This will process a hidden secondary twice - first as a 'hidden' server, then as a 'secondary' but
# this is effectively a no-op except for apt checking the versions and then checking that mongo is running.
# It is valid to have other types of hidden machines, so this seemed better than skipping.
#
# If you wish to avoid updating the primary, you can add -e 'SKIP_PRIMARY=true' to your ansible
# invocation.
- name: Find hidden secondaries - name: Find hidden secondaries
hosts: 127.0.0.1 hosts: 127.0.0.1
connection: local connection: local
gather_facts: False gather_facts: False
vars:
- SKIP_PRIMARY: False
tasks: tasks:
- name: Get configuration of mongo cluster - name: Get configuration of mongo cluster
mongodb_rs_config: mongodb_rs_config:
...@@ -49,6 +56,7 @@ ...@@ -49,6 +56,7 @@
ansible_ssh_user: ubuntu ansible_ssh_user: ubuntu
with_items: with_items:
- "{{ rs_config.primary }}" - "{{ rs_config.primary }}"
when: not SKIP_PRIMARY
- name: Upgrade hidden members - name: Upgrade hidden members
hosts: hidden_hosts hosts: hidden_hosts
......
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