Skip to content

Commit

Permalink
Fixed issue with multi-port binding timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
anatoly-chichikov committed Mar 11, 2017
1 parent 1ba531c commit 4fcbaa0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
5 changes: 3 additions & 2 deletions tasks/auth_initialization.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@
service: name={{ mongodb_daemon_name }} state=restarted
when: mongodb_manage_service

- name: wait MongoDB port is listening
wait_for: host="{{ mongodb_net_bindip }}" port="{{ mongodb_net_port }}" delay=5 state=started
- name: Wait MongoDB port is listening
wait_for: host="{{ item }}" port="{{ mongodb_net_port }}" delay=5 state=started
with_items: "{{ mongodb_net_bindip.split(',') | map('replace', '0.0.0.0', '127.0.0.1') | list }}"

- name: stop mongodb if was not started
shell: "kill {{ pidof_mongod.stdout }}"
Expand Down
8 changes: 2 additions & 6 deletions tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,9 @@
- name: Ensure service is started
service: name={{ mongodb_daemon_name }} state=started

- name: Set fact about wait_for host address
set_fact:
wait_for_host: 127.0.0.1
when: mongodb_net_bindip == "0.0.0.0"

- name: Wait when mongodb is started
wait_for:
host: "{{ wait_for_host | default(mongodb_net_bindip) }}"
host: "{{ item }}"
port: "{{ mongodb_net_port }}"
timeout: 120
with_items: "{{ mongodb_net_bindip.split(',') | map('replace', '0.0.0.0', '127.0.0.1') | list }}"

0 comments on commit 4fcbaa0

Please sign in to comment.