--- - name: OU-Struktur auf TurnKey LDAP einrichten hosts: ldap gather_facts: false vars: ldap_base_dn: "dc=heim,dc=lan" ldap_bind_dn: "cn=admin,{{ ldap_base_dn }}" ldap_bereiche: - main - cert - backup - iot - service - proxy - dmz - storage ldap_unterous: - Computers - Groups - Users vars_prompt: - name: ldap_admin_password prompt: "Passwort des LDAP-Administrators" private: true module_defaults: community.general.ldap_entry: server_uri: "ldapi:///" bind_dn: "{{ ldap_bind_dn }}" bind_pw: "{{ ldap_admin_password }}" state: present tasks: - name: Python-LDAP auf dem LDAP-LXC installieren ansible.builtin.apt: name: python3-ldap state: present update_cache: true cache_valid_time: 3600 - name: Bereichs-OUs anlegen community.general.ldap_entry: dn: "ou={{ item }},{{ ldap_base_dn }}" objectClass: - top - organizationalUnit attributes: ou: "{{ item }}" loop: "{{ ldap_bereiche }}" - name: Unter-OUs in jedem Bereich anlegen community.general.ldap_entry: dn: "ou={{ item.1 }},ou={{ item.0 }},{{ ldap_base_dn }}" objectClass: - top - organizationalUnit attributes: ou: "{{ item.1 }}" loop: "{{ ldap_bereiche | product(ldap_unterous) | list }}" loop_control: label: "{{ item.0 }}/{{ item.1 }}"