Commit 96b465ea by Kevin Falcone

Port tasks that wait for mongo to start and the cluster to have PRIMARY

parent 1a5c96fc
...@@ -49,3 +49,17 @@ ...@@ -49,3 +49,17 @@
force: yes force: yes
update_cache: yes update_cache: yes
with_items: mongodb_debian_pkgs with_items: mongodb_debian_pkgs
- name: wait for mongo server to start
wait_for:
port: 27017
delay: 2
- name: Wait for the replica set to update and (if needed) elect a primary
mongodb_rs_status:
host: "{{ ansible_default_ipv4['address'] }}"
username: "{{ MONGO_ADMIN_USER }}"
password: "{{ MONGO_ADMIN_PASSWORD }}"
register: status
until: status.status is defined and 'PRIMARY' in status.status.members|map(attribute='stateStr')|list
retries: 5
delay: 2
run_once: true
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