From df90644552cd9bc3f46257a52b94a0d1ed7afb09 Mon Sep 17 00:00:00 2001 From: Mohamed Nabil Hafez Date: Sun, 22 Nov 2015 11:58:35 +0200 Subject: [PATCH] Adding wait after mongodb restart --- tasks/auth_initialization.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tasks/auth_initialization.yml b/tasks/auth_initialization.yml index ea6454a..46dab52 100644 --- a/tasks/auth_initialization.yml +++ b/tasks/auth_initialization.yml @@ -6,6 +6,9 @@ service: name={{ mongodb_daemon_name }} state=restarted when: mongodb_manage_service +- name: wait MongoDB port is listening + wait_for: host="{{ mongodb_conf_bind_ip }}"port="{{ mongodb_conf_port }}" delay=5 state=started + - name: get pid of mongodb for non daemon mode shell: "pidof mongod" register: pidof_mongod @@ -64,6 +67,9 @@ service: name={{ mongodb_daemon_name }} state=restarted when: mongodb_manage_service +- name: wait MongoDB port is listening + wait_for: host="{{ mongodb_conf_bind_ip }}"port="{{ mongodb_conf_port }}" delay=5 state=started + - name: stop mongodb if was not started shell: "kill {{ pidof_mongod.stdout }}" when: mongodb_manage_service == false and pidof_mongod.rc == 0