diff --git a/tasks/main.yml b/tasks/main.yml index 3ddf3d7..cfda816 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -21,17 +21,18 @@ values: "{{ item.value }}" state: exact with_dict: + olcSuffix: "{{ ldap_suffix }}" olcRootDN: "{{ ldap_admin_dn }}" olcRootPW: "{{ ldap_admin_password }}" - olcSuffix: "{{ ldap_suffix }}" -- name: check if schema already loaded - command: ldapsearch -Y EXTERNAL -H ldapi:/// -b cn=schema,cn=config -LLL olcObjectClasses='*0.9.2342.19200300.100.4.13 NAME*' dn +- name: check if schema cosine is loaded + stat: + path: /etc/openldap/slapd.d/cn=config/cn=schema/cn={1}cosine.ldif register: result - name: import mandatory schema command: "ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/cosine.ldif" - when: not result.stdout.find( 'cosine,cn=schema,cn=config' ) + when: result.stat.exists==False - name: create suffix ldap_entry: