schema_openiam.yml 29 lignes · 971 octets
---
# Schéma openiam (OI-102, D-059) : objectClass auxiliaire openiamImported et ses attributs, posés
# par LSC sur les comptes et groupes importés. Ajouté en ligne à cn=schema,cn=config s'il manque :
# vaut pour un annuaire neuf comme pour un annuaire déjà initialisé.
- name: Vérifier la présence du schéma openiam
  ansible.builtin.command:
    argv:
      - "{{ oiam_ldap_prefixe }}/bin/ldapsearch"
      - -LLL
      - -Q
      - -Y
      - EXTERNAL
      - -H
      - "{{ oiam_ldap_ldapi }}"
      - -b
      - cn=schema,cn=config
      - -s
      - one
      - (cn=*openiam)
      - dn
  register: oiam_ldap_schema_openiam
  changed_when: false

- name: Ajouter le schéma openiam
  when: oiam_ldap_schema_openiam.stdout | length == 0
  ansible.builtin.command:
    argv: ["{{ oiam_ldap_prefixe }}/bin/ldapadd", -Q, -Y, EXTERNAL, -H, "{{ oiam_ldap_ldapi }}"]
    stdin: "{{ lookup('ansible.builtin.template', 'openiam.ldif.j2') }}"
  changed_when: true