Fix checking mongodb replication status

backport: stein, rocky

The reason it did not work before was that the other handlers had never been called
after [0], tasks from start.yml were move to handler which cannot act
like tasks, also bootstrap tasks must run after 'Restart mongodb container'.

This commit adds a notify after 'Restart mongodb container' for triger
task 'bootstrap_cluster.yml'.

[0] 40b635b9c5

Change-Id: I4e2fbe9a8f20afcc4e25a01e23e5231e74eeeec4
This commit is contained in:
Xing Zhang 2019-06-13 23:56:15 +08:00
parent cb0cb441c2
commit 6bb01bd7b1
No known key found for this signature in database
GPG Key ID: 43F80E57B910E3B0

View File

@ -25,6 +25,7 @@
notify:
- Waiting for the mongodb startup
- Checking current replication status
- Bootstrap cluster
- name: Waiting for the mongodb startup
wait_for: host={{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }} port={{ mongodb_port }}
@ -37,5 +38,6 @@
delegate_to: "{{ groups['mongodb'][0] }}"
run_once: True
- include_tasks: "bootstrap_cluster.yml"
- name: Bootstrap cluster
include_tasks: "bootstrap_cluster.yml"
when: mongodb_replication_status.stdout != "1"