---
- name: Restart mongod
  listen: Restart mongod service
  service:
    name: "{{ mongod_service }}"
    state: restarted
  when: not skip_restart

- name: Wait for port to become active
  listen: Restart mongod service
  wait_for:
    host: "{{ bind_ip | split(',') | first }}"
    port: "{{ mongod_port }}"
  when: not skip_restart

- name: Reload systemd configuration
  listen: daemon-reload
  systemd:
    daemon_reload: true
