microsoft.ad.as_datetime filter – Converts an LDAP value to a datetime string

Note

This filter plugin is part of the microsoft.ad collection (version 1.4.1).

You might already have this collection installed if you are using the ansible package. 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 microsoft.ad.

To use it in a playbook, specify: microsoft.ad.as_datetime.

New in microsoft.ad 1.1.0

Synopsis

  • Converts an LDAP integer or raw value to a datetime string.

  • Should be used with the microsoft.ad.ldap plugin to convert attribute values to a datetime string.

Input

This describes the input of the filter, the value before | microsoft.ad.as_datetime.

Parameter

Comments

Input

any / required

The LDAP attribute bytes or integer value representing a FILETIME integer stored in LDAP.

The resulting datetime will be set as a UTC datetime as that’s how the FILETIME value is stored in LDAP.

Keyword parameters

This describes keyword parameters of the filter. These are the values key1=value1, key2=value2 and so on in the following example: input | microsoft.ad.as_datetime(key1=value1, key2=value2, ...)

Parameter

Comments

format

string

The string format to format the datetime object as.

Defaults to an ISO 8601 compatible string, for example 2023-02-06T07:39:09.195321+0000.

Default: "%Y-%m-%dT%H:%M:%S.%f%z"

See Also

See also

microsoft.ad.as_guid

microsoft.ad.as_guid filter

microsoft.ad.as_sid

microsoft.ad.as_sid filter

microsoft.ad.ldap

microsoft.ad.ldap inventory

Examples

# This is an example used in the microsoft.ad.ldap plugin

# Converting from the coerced value
attributes:
  pwdLastSet: this | microsoft.ad.as_datetime

# Converting from the raw bytes value
attributes:
  maxPwdAge: raw | microsoft.ad.as_datetime

Return Value

Key

Description

Return value

string

The datetime string value(s) formatted as per the format option.

Returned: success

Authors

  • Jordan Borean (@jborean93)

Hint

Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.