new variable so we can chose attribute used for DN

This commit is contained in:
2024-05-13 14:49:38 +02:00
parent dff28b8327
commit 15fe4a5eb0
3 changed files with 3 additions and 1 deletions

View File

@@ -12,6 +12,7 @@ Role Variables
--------------
org: no default
ldap_base - from group variables
nlu_dn_attribute - default firstname can be email
binddn - from group variables
bindpwd - from group variables
file : default account.csv csv file containing user to create:

View File

@@ -1,2 +1,3 @@
---
# defaults file for tco.new_ldap_user
nlu_dn_attribute: "firstname"

View File

@@ -4,7 +4,7 @@
firstname: "{{ item.firstname }}"
lastname: "{{ item.lastname }}"
email: "{{ item.email }}"
dn: "uid={{ item.firstname |lower }}, ou={{ org }},{{ ldap_base }}"
dn: "uid={{ item[ nlu_dn_attribute ] |lower }},ou={{ org }},{{ ldap_base }}"
password: "{{ (item.password=='')| ternary(lookup('community.general.random_string', min_lower=1, min_upper=1, special=false,min_numeric=1, length=14), item.password ) }}"
- name: "add ldap account {{dn }}"