Skip to content

Add examples for LDIF file generation via Ansible #1

Description

@andreashaerter

It would be very helpful to add documented examples that show how LDIF files for this image can be generated using Ansible, for example via Jinja2 templates and structured variables.

Managing LDAP users, service accounts, and groups declaratively with Ansible would be cool and concrete examples would make it much easier to integrate this repository into existing Ansible-based workflows and infrastructure-as-code setups.

Proposed Content

Add a section to the documentation (e.g. README.md or an examples/ansible/ directory) that includes:

1. Ansible Jinja2 template examples, something like (rough drafts, not tested... you get the idea):

Service accounts

{% for svc in ldap_service_accounts %}
dn: cn={{ svc.name }},ou=services,{{ ldap_base_dn }}
objectClass: organizationalRole
objectClass: simpleSecurityObject
cn: {{ svc.name }}
description: {{ svc.description }}
userPassword: {{ svc.password_hash }}

{% endfor %}

Users

{% for user in ldap_users %}
dn: uid={{ user.uid }},ou=people,{{ ldap_base_dn }}
objectClass: inetOrgPerson
uid: {{ user.uid }}
cn: {{ user.cn }}
sn: {{ user.sn }}
givenName: {{ user.givenName }}
mail: {{ user.mail }}
userPassword: {{ user.password_hash }}
{% if user.telephoneNumber is defined %}
telephoneNumber: {{ user.telephoneNumber }}
{% endif %}

{% endfor %}

Groups with membership

{% for group in ldap_groups %}
dn: cn={{ group.cn }},ou=groups,{{ ldap_base_dn }}
objectClass: groupOfNames
cn: {{ group.cn }}
description: {{ group.description }}
{% for member_uid in group.members %}
member: uid={{ member_uid }},ou=people,{{ ldap_base_dn }}
{% endfor %}

{% endfor %}

2. Example Ansible variable structures

ldap_groups:
  - cn: opencloud-users
    description: Users with access to opencloud
    members:
      - john
      - jane
  - cn: opencloud-admins
    description: OpenCloud administrators
    members:
      - admin.user

Optional: Minimal Ansible playbook snippet, showing how to render these templates into LDIF files using template: and place them into /ldap/data.

This is purely a documentation / examples request, no functional changes to the image itself are required.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions