l3o.ldap3_orm.ldap_entry (1.3.0) — module

Add or remove LDAP entries based on ldap3-orm models

| "added in version" 1.0.0 of l3o.ldap3_orm"

Authors: Christian Felder (@cfelder)

This plugin has a corresponding action plugin.

Install collection

Install with ansible-galaxy collection install l3o.ldap3_orm:==1.3.0


Add to requirements.yml

  collections:
    - name: l3o.ldap3_orm
      version: 1.3.0

Description

Add or remove LDAP entries based on ldap3-orm models.

Modifies existing entries.

Uses ldap3_orm configuration files.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create or Update entry
  l3o.ldap3_orm.ldap_entry:
    config: default
    dn: "uid={uid},ou=People,dc=example,dc=com"
    objectClass: inetOrgPerson
    attributes:
      uid: guest
      sn: User
      cn: Guest User
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete entry using objectClass and attributes with templated dn
  l3o.ldap3_orm.ldap_entry:
    config: default
    state: absent
    dn: "uid={uid},ou=People,dc=example,dc=com"
    objectClass: inetOrgPerson
    attributes:
      uid: guest
      sn: Mustermann 42
      cn: Max Mustermann 42
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete entry using dn only
  l3o.ldap3_orm.ldap_entry:
    config: default
    state: absent
    dn: "uid=guest,ou=People,dc=example,dc=com"

Inputs

    
dn:
    description:
    - Distinguished name, an unique identifier in your ldap tree
    - This attribute can be defined as a template using python's built-in C(format) function.
      All attributes defined in I(attributes) will be expanded. Furthermore the generated
      DN will be normalized and escaped using the C(ldap3.utils.dn.safe_dn) function.
    required: true
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Whether a ldap entry should be present or absent
    type: str

config:
    description:
    - ldap3-orm configuration file (name or full qualified path)
    - See U(http://code.bsm-felder.de/doc/ldap3-orm/latest/classes/config.html) for an
      overview.
    required: true
    type: str

decrypt:
    default: true
    description:
    - This option controls the autodecryption of source files using vault.
    type: bool
    version_added: '2.4'
    version_added_collection: ansible.builtin

attributes:
    description:
    - Attributes necessary to create an entry defined by I(objectClass).
    - Attribute keys may be used as templates in I(dn) and are replaced with its values.
    - Required when I(state=present) or when using templates in dn.

objectClass:
    description:
    - One or multiple object class(es) which should be included in the generated model.
    - Required when I(state=present) or when using templates in dn.
    required: false

Outputs

actions:
  description:
  - Human-readable representation of actions performed on the ldap server
  returned: always
  sample:
  - Created dn 'uid=guest,ou=People,dc=example,dc=com'
  - Modified dn 'uid=guest,ou=People,dc=example,dc=com'
  - Deleted dn 'uid=guest,ou=People,dc=example,dc=com'
  type: list