Factor out password store retrieval

This commit is contained in:
Timotej Lazar 2024-07-04 15:31:25 +02:00
parent 973522c373
commit f10d94612f
7 changed files with 18 additions and 21 deletions

View file

@ -6,11 +6,11 @@ import re
import ldap3
{% set password = lookup('passwordstore', "cluster/"+cluster.name, returnall=true) | from_yaml %}
{% set cluster_password = lookup('passwordstore', "cluster/"+cluster.name, returnall=true) | from_yaml %}
realm = '{{ hostvars[inventory_hostname]["sync-ldap"] }}'
ldap_host = '{{ domain }}'
ldap_user = '{{ password.ldap_user }}'
ldap_pass = '{{ password.ldap_pass }}'
ldap_user = '{{ cluster_password.ldap_user }}'
ldap_pass = '{{ cluster_password.ldap_pass }}'
ldap_base = '{{ domain | split(".") | map("regex_replace", "^", "dc=") | join(",") }}'
# build LDAP query for users