if empty, password is generated
This commit is contained in:
@@ -1,19 +1,12 @@
|
||||
---
|
||||
- name: add ldap ou
|
||||
community.general.ldap_entry:
|
||||
dn: "ou={{ org }},{{ ldap_base }}"
|
||||
bind_dn: "{{ binddn }}"
|
||||
bind_pw: "{{ bindpwd }}"
|
||||
objectClass:
|
||||
- organizationalUnit
|
||||
- top
|
||||
|
||||
- name: add ldap account
|
||||
vars:
|
||||
- name: set vars
|
||||
ansible.builtin.set_fact:
|
||||
firstname: "{{ item.firstname }}"
|
||||
lastname: "{{ item.lastname }}"
|
||||
email: "{{ item.email }}"
|
||||
password: "{{ (item.password=='')| ternary(lookup('community.general.random_string', min_lower=1, min_upper=1, min_special=1, min_numeric=1, length=14), item.password ) }}"
|
||||
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 }}"
|
||||
community.general.ldap_entry:
|
||||
bind_dn: "{{ binddn }}"
|
||||
bind_pw: "{{ bindpwd }}"
|
||||
@@ -31,3 +24,9 @@
|
||||
PreferredDeliveryMethod: any
|
||||
displayName: "{{ firstname }} {{ lastname }}"
|
||||
userPassword: "{{ password }}"
|
||||
register: result
|
||||
|
||||
- name: display
|
||||
debug:
|
||||
msg: "{{ firstname }} created with password >{{ password }}<"
|
||||
when: result.changed
|
||||
|
||||
Reference in New Issue
Block a user