From 884cbb2123ac9746369cd4b454d5cd820fb07286 Mon Sep 17 00:00:00 2001 From: Thomas Constans Date: Fri, 31 Mar 2023 16:46:18 +0200 Subject: [PATCH] no more org in csv --- README.md | 4 ++-- tasks/ldap_user_inc.yml | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 90a5ed6..a8baadc 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ bindpwd - from group variables file : default account.csv csv file containing user to create: ```csv -org,firstname,lastname,email,[password] +firstname,lastname,email,[password] ``` password field optionnal - if empty will be generated automatically - WIP @@ -38,7 +38,7 @@ Including an example of how to use your role (for instance, with variables passe user: tom become: false roles: - - { role: tco.new_ldap_user, file: ~/Documents/Opendoor/Clients/Plop/account.csv } + - { role: tco.new_ldap_user, org=plop.fr,file: ~/Documents/Opendoor/Clients/Plop/account.csv } License ------- diff --git a/tasks/ldap_user_inc.yml b/tasks/ldap_user_inc.yml index 5d1465d..2cf28e6 100644 --- a/tasks/ldap_user_inc.yml +++ b/tasks/ldap_user_inc.yml @@ -4,13 +4,14 @@ firstname: "{{ item.firstname }}" lastname: "{{ item.lastname }}" email: "{{ item.email }}" + dn: "uid={{ item.firstname |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 {{ item.firstname }}" + - name: "add ldap account {{dn }}" community.general.ldap_entry: bind_dn: "{{ binddn }}" bind_pw: "{{ bindpwd }}" - dn: "uid={{ firstname |lower }}, ou={{ org }},{{ ldap_base }}" + dn: "{{ dn }} " state: present objectClass: - inetorgperson