Merge pull request #77 from anatoly-chichikov/multiple-ip-binding-fix

Fixed issue with multi-port binding timeouts
This commit is contained in:
Sergei Antipov 2017-03-19 23:31:06 +07:00 committed by GitHub
commit cb74360585
2 changed files with 5 additions and 8 deletions

View File

@ -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 }}"

View File

@ -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 }}"