ansible-role-mongodb/handlers/main.yml

41 lines
1.0 KiB
YAML

---
- name: reload systemd
systemd:
daemon_reload: yes
when: ansible_service_mgr == "systemd" and mongodb_manage_service
- name: mongodb reload
service: name={{ mongodb_daemon_name }} state=reloaded
when: mongodb_manage_service|bool
- name: mongodb restart
service: name={{ mongodb_daemon_name }} state=restarted
when: mongodb_manage_service|bool
- name: mongodb-mms-monitoring-agent restart
service: name=mongodb-mms-monitoring-agent state=restarted
when: mongodb_manage_service|bool
- name: restart sysfsutils
service: name=sysfsutils state=restarted
- name: service started
service:
name: "{{ mongodb_daemon_name }}"
state: started
- name: wait when mongodb is started
wait_for:
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 }}"
- name: wait when mongodb is started on localhost
wait_for:
host: "127.0.0.1"
port: "{{ mongodb_net_port }}"
delay: 5
timeout: 120