ripclawffb.helix_core.helix_core_ldap module – Manage LDAP configurations on Perforce Helix Core

Note

This module is part of the ripclawffb.helix_core collection (version 1.3.0).

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install ripclawffb.helix_core. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: ripclawffb.helix_core.helix_core_ldap.

New in ripclawffb.helix_core 1.1.0

Synopsis

  • This module allows you to create, modify, or delete LDAP configurations on Perforce Helix Core.

  • Supports various bind methods (simple, search, sasl) and encryption types.

Requirements

The below requirements are needed on the host that executes this module.

  • P4Python pip module is required

Parameters

Parameter

Comments

attribute_email

string

The attribute used for the user’s email address.

attribute_name

string

The attribute used for the user’s full name.

attribute_uid

string

The attribute used for the user ID.

bind_method

string

The method used to bind to the LDAP server.

Choices:

  • "simple" ← (default)

  • "search"

  • "sasl"

charset

aliases: p4charset

string

Character set used for translation of unicode files

Can also use ‘P4CHARSET’ environment variable

Default: "none"

encryption

string

The encryption method used to connect to the LDAP server.

Choices:

  • "none" ← (default)

  • "ssl"

  • "tls"

group_base_dn

string

The base DN for searching groups.

group_search_filter

string

The filter used to search for groups.

host

string / required

The LDAP server hostname or IP address.

name

string / required

The name of the LDAP configuration.

options

list / elements=string

specific options for the LDAP configuration.

Choices:

  • "downcase"

  • "nodowncase"

  • "getattrs"

  • "nogetattrs"

  • "realminusername"

  • "norealminusername"

password

aliases: p4passwd

string / required

The login password

Can also use ‘P4PASSWD’ environment variable

port

integer / required

The LDAP server port.

search_base_dn

string

The base DN for searching users.

Required if bind_method is ‘search’.

search_bind_dn

string

The DN used to bind to the LDAP server for searching.

search_filter

string

The search filter used to find users (e.g., (uid=%user%)).

Required if bind_method is ‘search’.

search_passwd

string

The password used to bind to the LDAP server for searching.

server

aliases: p4port

string / required

The hostname/ip and port of the server (perforce:1666)

Can also use ‘P4PORT’ environment variable

simple_pattern

string

The pattern used for simple binding (e.g., uid=%user%,ou=users,dc=example,dc=com).

Required if bind_method is ‘simple’.

state

string

Whether the LDAP configuration should exist or not.

Choices:

  • "present" ← (default)

  • "absent"

user

aliases: p4user

string / required

A user with access to perform this operation

Can also use ‘P4USER’ environment variable

See Also

See also

Helix Core LDAP

Manage LDAP configurations

P4Python Pip Module

Python module to interact with Helix Core

Examples

- name: Create LDAP configuration with simple bind
  ripclawffb.helix_core.helix_core_ldap:
    name: simple_ldap
    host: ldap.example.com
    port: 389
    encryption: none
    bind_method: simple
    simple_pattern: "uid=%user%,ou=users,dc=example,dc=com"
    options:
      - nodowncase
      - getattrs
    server: '1666'
    user: bruno
    password: ''

- name: Create LDAP configuration with search bind
  ripclawffb.helix_core.helix_core_ldap:
    name: search_ldap
    host: ldap.example.com
    port: 636
    encryption: ssl
    bind_method: search
    search_base_dn: "ou=users,dc=example,dc=com"
    search_filter: "(uid=%user%)"
    search_bind_dn: "cn=admin,dc=example,dc=com"
    search_passwd: "secret_password"
    options:
      - downcase
      - getattrs
    server: '1666'
    user: bruno
    password: ''

- name: Remove LDAP configuration
  ripclawffb.helix_core.helix_core_ldap:
    name: simple_ldap
    state: absent
    host: ldap.example.com
    port: 389
    server: '1666'
    user: bruno
    password: ''

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

action

string

The action performed on the resource.

Returned: always

Can only return:

  • "created"

  • "updated"

  • "deleted"

  • "unchanged"

Sample: "created"

changed

boolean

Whether any changes were made to the LDAP configuration.

Returned: always

Sample: true

changes

list / elements=dictionary

List of fields that were changed.

Returned: always

Sample: [{"after": "new.ldap.com", "before": "old.ldap.com", "field": "Host"}]

diff

dictionary

A dictionary containing ‘before’ and ‘after’ state of the resource.

Returned: when diff mode is enabled

after

string

The state of the resource after the action.

Returned: success

before

string

The state of the resource before the action.

Returned: success

ldap_spec

dictionary

The LDAP configuration specification.

Returned: always

Sample: {"BindMethod": "simple", "Encryption": "none", "Host": "ldap.example.com", "Name": "simple_ldap", "Port": 389}

Authors

  • Asif Shaikh (@ripclawffb)