remoteauth_retrait.yml 22 lignes · 1104 octets
---
# Bascule d'une migration Active Directory (OI-105) : plus aucune authentification déléguée. Le
# module reste chargé (un module ne se décharge pas à chaud) ; sans overlay, il n'agit plus.
- name: Chercher l'overlay remoteauth
  ansible.builtin.command:
    argv: ["{{ oiam_ldap_prefixe }}/bin/ldapsearch", -LLL, -Q, -Y, EXTERNAL, -H, "{{ oiam_ldap_ldapi }}",
           -b, "olcDatabase={2}mdb,cn=config", -s, one, "(objectClass=olcRemoteAuthCfg)", dn]
  register: oiam_ldap_remoteauth_present
  changed_when: false

- name: Retirer l'overlay remoteauth
  ansible.builtin.command:
    argv: ["{{ oiam_ldap_prefixe }}/bin/ldapdelete", -Q, -Y, EXTERNAL, -H, "{{ oiam_ldap_ldapi }}",
           "{{ oiam_ldap_remoteauth_present.stdout | regex_search('(?m)^dn: (.*)$', '\\1') | first }}"]
  when: oiam_ldap_remoteauth_present.stdout | length > 0
  changed_when: true

- name: Retirer les autorités des sources et la référence de remoteauth
  ansible.builtin.file:
    path: "{{ item }}"
    state: absent
  loop: ["{{ oiam_ldap_remoteauth_autorites }}", "{{ oiam_ldap_remoteauth_reference }}"]