cisco.intersight.intersight_ldap_policy module – Manage LDAP Policies for Cisco Intersight
Note
This module is part of the cisco.intersight collection (version 2.12.0).
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 cisco.intersight.
To use it in a playbook, specify: cisco.intersight.intersight_ldap_policy.
Synopsis
Create, update, and delete LDAP Policies on Cisco Intersight.
Manage LDAP groups and providers associated with LDAP policies.
LDAP policies enable authentication of Cisco IMC users using an LDAP server.
For more information see Cisco Intersight.
Parameters
Parameter |
Comments |
|---|---|
Public API Key ID associated with the private key. If not set, the value of the INTERSIGHT_API_KEY_ID environment variable is used. |
|
Filename (absolute path) or string of PEM formatted private key data to be used for Intersight API authentication. If a string is used, Ansible vault should be used to encrypt string data. Ex. ansible-vault encrypt_string --vault-id tme@/Users/dsoper/Documents/vault_password_file ‘-----BEGIN EC PRIVATE KEY----- <your private key data> -----END EC PRIVATE KEY-----’ If not set, the value of the INTERSIGHT_API_PRIVATE_KEY environment variable is used. |
|
URI used to access the Intersight API. If not set, the value of the INTERSIGHT_API_URI environment variable is used. Default: |
|
Role and locale information of the user. Required when state is present. |
|
Base Distinguished Name (DN). Starting point from where server will search for users and groups. Required when state is present. |
|
Distinguished Name (DN) of the user, that is used to authenticate against LDAP servers. Required when bind_method is configuredcredentials. |
|
Authentication method to access LDAP servers.
Choices:
|
|
The user-defined description for the LDAP Policy. Description can contain letters(a-z, A-Z), numbers(0-9), hyphen(-), period(.), colon(:), or an underscore(_). |
|
Source of the domain name used for the DNS SRV request.
Only applicable when enable_dns is true. Choices:
|
|
The IPv4 domain that all users must be in. Required when state is present. |
|
Enables DNS to access LDAP servers. When enabled, LDAP providers cannot be specified (DNS discovery is used instead). When disabled, at least one LDAP provider must be configured. Choices:
|
|
If enabled, the endpoint encrypts all information it sends to the LDAP server. Choices:
|
|
If enabled, LDAP server performs authentication. Choices:
|
|
Criteria to identify entries in search requests. Required when state is present. |
|
Groups to which an LDAP entry belongs. Required when state is present. |
|
If enabled, user authorization is also done at the group level for LDAP users not in the local user database. Choices:
|
|
List of LDAP groups to be created and attached to the LDAP policy. Each group defines the mapping between LDAP server groups and Intersight roles. |
|
LDAP server domain the Group resides in. |
|
LDAP Group DN in the LDAP server database. Required when state is present. |
|
LDAP Group name in the LDAP server database. |
|
Role assigned to all users in this LDAP server group.
Only ‘admin’ role is supported in domain. Required when state is present. Choices:
|
|
Whether to create/update or delete the LDAP group. Choices:
|
|
List of LDAP providers (servers) to be created and attached to the LDAP policy. Providers define the LDAP servers to connect to. Cannot be specified when enable_dns is true (DNS discovery is used instead). Required when enable_dns is false (at least one provider must be specified). |
|
Port number on which the LDAP server is listening. Default: |
|
IP address or hostname of the LDAP server. Required when state is present. |
|
Whether to create/update or delete the LDAP provider. Choices:
|
|
Type of LDAP server.
Choices:
|
|
The name assigned to the LDAP Policy. Must be unique within the organization. The name must be between 1 and 62 alphanumeric characters, allowing special characters :-_. |
|
If enabled, an extended search walks the chain of ancestry all the way to the root. Returns all the groups and subgroups, each of those groups belong to recursively. Choices:
|
|
Search depth to look for a nested LDAP group in an LDAP group map. Valid range is 1-128. Only applicable when nested_group_search is true. Default: |
|
The name of the Organization this resource is assigned to. Policies created within a Custom Organization are applicable only to devices in the same Organization. Use ‘default’ for the default organization. Default: |
|
The password of the user for initial bind process. Can have any character except spaces, tabs, line breaks. Cannot be more than 254 characters. Required when bind_method is configuredcredentials. |
|
Domain name that acts as a source for a DNS query. Required when dns_source is configured or configuredextracted. |
|
Forest name that acts as a source for a DNS query. Required when dns_source is configured or configuredextracted. |
|
If If Choices:
|
|
List of tags in Key:<user-defined key> Value:<user-defined value> format. |
|
LDAP authentication timeout duration, in seconds. Valid range is 0-180. Default: |
|
If Choices:
|
|
Search precedence between local user database and LDAP user database.
Choices:
|
|
Boolean control for verifying the api_uri TLS certificate Choices:
|
Examples
- name: Create LDAP Policy with DNS enabled
cisco.intersight.intersight_ldap_policy:
api_private_key: "{{ api_private_key }}"
api_key_id: "{{ api_key_id }}"
organization: "default"
name: "ldap-dns-policy"
description: "LDAP policy using DNS for server discovery"
enable_ldap: true
base_dn: "dc=example,dc=com"
domain: "example.com"
timeout: 30
enable_encryption: true
bind_method: "logincredentials"
filter: "sAMAccountName"
group_attribute: "memberOf"
attribute: "CiscoAvPair"
group_authorization: true
nested_group_search: true
nested_group_search_depth: 64
enable_dns: true
dns_source: "configured"
search_domain: "example.com"
search_forest: "example.com"
user_search_precedence: "localuserdb"
ldap_groups:
- name: "admin-group"
group_dn: "cn=admins,ou=groups,dc=example,dc=com"
domain: "example.com"
role: "admin"
- name: "readonly-group"
group_dn: "cn=readers,ou=groups,dc=example,dc=com"
role: "readonly"
tags:
- Key: "Environment"
Value: "Production"
state: present
- name: Create LDAP Policy with providers
cisco.intersight.intersight_ldap_policy:
api_private_key: "{{ api_private_key }}"
api_key_id: "{{ api_key_id }}"
organization: "default"
name: "ldap-provider-policy"
description: "LDAP policy with specific servers"
enable_ldap: true
base_dn: "company"
domain: "company.local"
timeout: 0
enable_encryption: false
bind_method: "anonymous"
filter: "sAMAccountName"
group_attribute: "memberOf"
attribute: "CiscoAvPair"
group_authorization: false
nested_group_search: false
enable_dns: false
user_search_precedence: "localuserdb"
ldap_providers:
- server: "10.10.10.10"
port: 389
vendor: "openldap"
- server: "10.10.10.11"
port: 389
vendor: "openldap"
ldap_groups:
- name: "users-group"
group_dn: "company"
role: "user"
state: present
- name: Create LDAP Policy with configured credentials
cisco.intersight.intersight_ldap_policy:
api_private_key: "{{ api_private_key }}"
api_key_id: "{{ api_key_id }}"
organization: "default"
name: "ldap-configured-creds"
description: "LDAP policy with configured bind credentials"
enable_ldap: true
base_dn: "dc=corp,dc=net"
domain: "corp.net"
timeout: 60
enable_encryption: true
bind_method: "configuredcredentials"
bind_dn: "cn=admin,dc=corp,dc=net"
password: "SecurePassword123"
filter: "uid"
group_attribute: "gidNumber"
attribute: "description"
group_authorization: true
nested_group_search: true
nested_group_search_depth: 128
enable_dns: false
user_search_precedence: "ldapuserdb"
ldap_providers:
- server: "ldap.corp.net"
port: 636
vendor: "msad"
ldap_groups:
- name: "administrators"
group_dn: "cn=administrators,ou=groups,dc=corp,dc=net"
domain: "corp.net"
role: "admin"
state: present
- name: Update LDAP Policy - manage group states
cisco.intersight.intersight_ldap_policy:
api_private_key: "{{ api_private_key }}"
api_key_id: "{{ api_key_id }}"
organization: "default"
name: "ldap-dns-policy"
description: "Updated LDAP policy"
enable_ldap: true
base_dn: "dc=example,dc=com"
domain: "example.com"
filter: "sAMAccountName"
group_attribute: "memberOf"
attribute: "CiscoAvPair"
enable_dns: true
ldap_groups:
- name: "admin-group"
group_dn: "cn=admins,ou=groups,dc=example,dc=com"
role: "admin"
state: present
- name: "old-group"
state: absent
- name: "new-group"
group_dn: "cn=new,ou=groups,dc=example,dc=com"
role: "user"
state: present
state: present
- name: Delete LDAP Policy
cisco.intersight.intersight_ldap_policy:
api_private_key: "{{ api_private_key }}"
api_key_id: "{{ api_key_id }}"
name: "old-ldap-policy"
state: absent
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
The API response output returned by the specified resource. Returned: always Sample: |