diff --git a/README.md b/README.md index a8baadc..cc06fa6 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/defaults/main.yml b/defaults/main.yml index 56fa136..3389d1d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,2 +1,3 @@ --- # defaults file for tco.new_ldap_user +nlu_dn_attribute: "firstname" diff --git a/tasks/ldap_user_inc.yml b/tasks/ldap_user_inc.yml index 10803d7..0e1ffe8 100644 --- a/tasks/ldap_user_inc.yml +++ b/tasks/ldap_user_inc.yml @@ -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 }}"