---
#   Delete user from ldap-master
#   Unser info comes from datadir
#   vars:
#     USERLOGIN is given to playbook on commandline

dependencies:
  - role: load_users

- name: ldap_deluser - exit if USERLOGIN is not given on commandline
  meta: end_play
  run_once: true
  when: USERLOGIN is undefined
  # always execute
  check_mode: false

## this can be done with perfact-useradmin on perfact-login-prod
## after theese commands have been implemented in T241113
#
#### LDAP for perfact-file ###
#- name: remove USERLOGIN from all groups on ou=groups, ou=file, {{ ldap_basedn }}
#- name: remove DN: CN=USERLOGIN, ou=users, ou=file, {{ ldap_basedn }}
#
#
#### LDAP for perfact-mail ###
#- name: remove USERLOGIN from all aliases (Verteilerlisten)
#  # # example data in ldap:
#  # cn=MAILVERTEILER,ou=mailaliases,ou=mail,dc=perfact,dc=de
#  # rfc822MailMember: amustermann
#
#- name: remove dn: cn=USERLOGIN, ou=users, ou=mail, {{ ldap_basedn }}
#  # do not remove user as long the auteresponder is required
#  # example data:
#  #   dn: cn=USERLOGIN, ou=users, ou=mail, {{ ldap_basedn }}
#  #   ...
#  #   mailacceptinggeneralid: anton.mustermann@perfact.de
#  #   mailacceptinggeneralid: mustermann@perfact.de
#  #   mailacceptinggeneralid: amu@perfact.de
#