- name: LDAP packages are installed
  apt:
    name:
      - slapd
      - ldap-utils
      - ldapvi
      - shelldap
    state: present
    update_cache: yes

- name: change slapd listen ip:port
  lineinfile:
    dest: /etc/default/slapd
    regexp: 'SLAPD_SERVICES=.*'
    line: "SLAPD_SERVICES=\"{{ ldap_listen }}\""
  notify: restart slapd

- name: ldapvirc file
  include: ldapvirc.yml

- name: nagios config file for LDAP
  include: nagios.yml

- name: initialize database
  include: init.yml
  when: not root_ldapvirc_path.stat.exists