Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem: microsoft.ad.ldap for Dynamic Inventory #2783

Open
rahs opened this issue Mar 6, 2025 · 0 comments
Open

Problem: microsoft.ad.ldap for Dynamic Inventory #2783

rahs opened this issue Mar 6, 2025 · 0 comments

Comments

@rahs
Copy link

rahs commented Mar 6, 2025

Issue

I'm encountering an error while using microsoft.ad.ldap plugin (https://docs.ansible.com/ansible/latest/collections/microsoft/ad/ldap_inventory.html) for inventory.

Ldap authentification by environment variables
MICROSOFT_AD_LDAP_USERNAME and MICROSOFT_AD_LDAP_PASSWORD

microsoft.ad.ldap.yml:

plugin: microsoft.ad.ldap
server: server.domain.com
port: 389
encrypt: false
auth_protocol: simple
search_base: OU=Servers,DC=domain,DC=com
filter: (&(OperatingSystem=*Windows Server*)(lastlogontimestamp>=133370928947794167)(!(Description=Failover cluster*)))
compose:
  host_var: computer_sid
groups:
  windows: true

Run command in CLI:

  export MICROSOFT_AD_LDAP_PASSWORD=password
  export MICROSOFT_AD_LDAP_USERNAME=username
  ansible-inventory -i microsoft.ad.ldap.yml --list

works fine.

In Semaphore:

[WARNING]:  * Failed to parse
10:51:05 AM
/tmp/semaphore/inventory_2147483634/microsoft.ad.ldap.yml with auto plugin:
10:51:05 AM
Received LDAPResult error search request failed - OPERATIONS_ERROR - 000004DC:
10:51:05 AM
LdapErr: DSID-0C090C90, comment: In order to perform this operation a
10:51:05 AM
successful bind must be completed on the connection., data 0, v4563

Impact

Ansible (task execution)

Installation method

Package

Database

BoltDB

Browser

Microsoft Edge

Semaphore Version

Semaphore 2.12.9-e693f31-1739369393

Ansible Version

ansible --version
ansible [core 2.14.18]
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.11.2 (main, Nov 30 2024, 21:22:50) [GCC 12.2.0] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True



Collection                    Version
----------------------------- -------
amazon.aws                    5.5.1  
ansible.netcommon             4.1.0  
ansible.posix                 1.5.4  
ansible.utils                 2.10.3 
ansible.windows               1.14.0 
arista.eos                    6.0.1  
awx.awx                       21.14.0
azure.azcollection            1.16.0 
check_point.mgmt              4.0.0  
chocolatey.chocolatey         1.4.0  
cisco.aci                     2.6.0  
cisco.asa                     4.0.1  
cisco.dnac                    6.7.2  
cisco.intersight              1.0.27 
cisco.ios                     4.6.1  
cisco.iosxr                   4.1.0  
cisco.ise                     2.5.12 
cisco.meraki                  2.15.1 
cisco.mso                     2.4.0  
cisco.nso                     1.0.3  
cisco.nxos                    4.4.0  
cisco.ucs                     1.8.0  
cloud.common                  2.1.3  
cloudscale_ch.cloud           2.3.1  
community.aws                 5.5.0  
community.azure               2.0.0  
community.ciscosmb            1.0.6  
community.crypto              2.14.0 
community.digitalocean        1.23.0 
community.dns                 2.5.5  
community.docker              3.4.7  
community.fortios             1.0.0  
community.general             6.6.2  
community.google              1.0.0  
community.grafana             1.5.4  
community.hashi_vault         4.2.1  
community.hrobot              1.8.0  
community.libvirt             1.2.0  
community.mongodb             1.6.0  
community.mysql               3.7.2  
community.network             5.0.0  
community.okd                 2.3.0  
community.postgresql          2.4.2  
community.proxysql            1.5.1  
community.rabbitmq            1.2.3  
community.routeros            2.8.2  
community.sap                 1.0.0  
community.sap_libs            1.4.1  
community.skydive             1.0.0  
community.sops                1.6.2  
community.vmware              3.7.0  
community.windows             1.13.0 
community.zabbix              1.9.3  
containers.podman             1.10.2 
cyberark.conjur               1.2.0  
cyberark.pas                  1.0.19 
dellemc.enterprise_sonic      2.0.0  
dellemc.openmanage            6.3.0  
dellemc.os10                  1.1.1  
dellemc.os6                   1.0.7  
dellemc.os9                   1.0.4  
dellemc.powerflex             1.6.0  
dellemc.unity                 1.6.0  
f5networks.f5_modules         1.25.0 
fortinet.fortimanager         2.2.0  
fortinet.fortios              2.3.0  
frr.frr                       2.0.2  
gluster.gluster               1.0.2  
google.cloud                  1.1.3  
grafana.grafana               1.1.1  
hetzner.hcloud                1.11.0 
hpe.nimble                    1.1.4  
ibm.qradar                    2.1.0  
ibm.spectrum_virtualize       1.12.0 
infinidat.infinibox           1.3.12 
infoblox.nios_modules         1.5.0  
inspur.ispim                  1.3.0  
inspur.sm                     2.3.0  
junipernetworks.junos         4.1.0  
kubernetes.core               2.4.0  
lowlydba.sqlserver            1.3.1  
mellanox.onyx                 1.0.0  
microsoft.ad                  1.2.0  
netapp.aws                    21.7.0 
netapp.azure                  21.10.0
netapp.cloudmanager           21.22.0
netapp.elementsw              21.7.0 
netapp.ontap                  22.7.0 
netapp.storagegrid            21.11.1
netapp.um_info                21.8.0 
netapp_eseries.santricity     1.4.0  
netbox.netbox                 3.13.0 
ngine_io.cloudstack           2.3.0  
ngine_io.exoscale             1.0.0  
ngine_io.vultr                1.1.3  
openstack.cloud               1.10.0 
openvswitch.openvswitch       2.1.1  
ovirt.ovirt                   2.4.1  
purestorage.flasharray        1.19.1 
purestorage.flashblade        1.11.0 
purestorage.fusion            1.5.0  
sensu.sensu_go                1.13.2 
splunk.es                     2.1.0  
t_systems_mms.icinga_director 1.33.1 
theforeman.foreman            3.11.0 
vmware.vmware_rest            2.3.1  
vultr.cloud                   1.8.0  
vyos.vyos                     4.1.0  
wti.remote                    1.0.5

Logs & errors

11:23:50 AM
Task 2147483633 added to queue
11:23:54 AM
Started: 2147483633
11:23:54 AM
Run TaskRunner with template: ping
11:23:54 AM
Preparing: 2147483633
11:24:03 AM
Updating Repository https://.../ansible.git
11:24:04 AM
From https://.../ansible.git
11:24:04 AM
 * branch            master     -> FETCH_HEAD
11:24:04 AM
Already up to date.
11:24:04 AM
Get current commit hash
11:24:04 AM
Get current commit message
11:24:04 AM
cloning inventory repository
11:24:04 AM
Cloning Repository https://.../ansible.git
11:24:04 AM
Cloning into 'inventory_2147483633'...
11:24:05 AM
No /tmp/semaphore/repository_1_1/collections/requirements.yml file found. Skip galaxy install process.
11:24:05 AM
No /tmp/semaphore/repository_1_1/requirements.yml file found. Skip galaxy install process.
11:24:05 AM
No /tmp/semaphore/repository_1_1/roles/requirements.yml file found. Skip galaxy install process.
11:24:05 AM
No /tmp/semaphore/repository_1_1/requirements.yml file found. Skip galaxy install process.
11:24:05 AM
ansible-playbook [core 2.14.18]
11:24:05 AM
  config file = None
11:24:05 AM
  configured module search path = ['/tmp/semaphore/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
11:24:05 AM
  ansible python module location = /usr/lib/python3/dist-packages/ansible
11:24:05 AM
  ansible collection location = /tmp/semaphore/.ansible/collections:/usr/share/ansible/collections
11:24:05 AM
  executable location = /usr/bin/ansible-playbook
11:24:05 AM
  python version = 3.11.2 (main, Nov 30 2024, 21:22:50) [GCC 12.2.0] (/usr/bin/python3)
11:24:05 AM
  jinja version = 3.1.2
11:24:05 AM
  libyaml = True
11:24:05 AM
No config file found; using defaults
11:24:05 AM
setting up inventory plugins
11:24:05 AM
host_list declined parsing /tmp/semaphore/inventory_2147483633/microsoft.ad.ldap.yml as it did not pass its verify_file() method
11:24:05 AM
script declined parsing /tmp/semaphore/inventory_2147483633/microsoft.ad.ldap.yml as it did not pass its verify_file() method
11:24:05 AM
Loading collection microsoft.ad from /usr/lib/python3/dist-packages/ansible_collections/microsoft/ad
11:24:06 AM
Using inventory plugin 'ansible_collections.microsoft.ad.plugins.inventory.ldap' to process inventory source '/tmp/semaphore/inventory_2147483633/microsoft.ad.ldap.yml'
11:24:06 AM
toml declined parsing /tmp/semaphore/inventory_2147483633/microsoft.ad.ldap.yml as it did not pass its verify_file() method
11:24:06 AM
[WARNING]:  * Failed to parse
11:24:06 AM
/tmp/semaphore/inventory_2147483633/microsoft.ad.ldap.yml with auto plugin:
11:24:06 AM
Received LDAPResult error search request failed - OPERATIONS_ERROR - 000004DC:
11:24:06 AM
LdapErr: DSID-0C090C90, comment: In order to perform this operation a
11:24:06 AM
successful bind must be completed on the connection., data 0, v4563
11:24:06 AM
  File "/usr/lib/python3/dist-packages/ansible/inventory/manager.py", line 293, in parse_source
11:24:06 AM
    plugin.parse(self._inventory, self._loader, source, cache=cache)
11:24:06 AM
  File "/usr/lib/python3/dist-packages/ansible/plugins/inventory/auto.py", line 59, in parse
11:24:06 AM
    plugin.parse(inventory, loader, path, cache=cache)
11:24:06 AM
  File "/usr/lib/python3/dist-packages/ansible_collections/microsoft/ad/plugins/inventory/ldap.py", line 297, in parse
11:24:06 AM
    schema = LDAPSchema.load_schema(client)
11:24:06 AM
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11:24:06 AM
  File "/usr/lib/python3/dist-packages/ansible_collections/microsoft/ad/plugins/plugin_utils/_ldap/schema.py", line 33, in load_schema
11:24:06 AM
    client.search(
11:24:06 AM
  File "/usr/lib/python3/dist-packages/ansible_collections/microsoft/ad/plugins/plugin_utils/_ldap/client.py", line 275, in search
11:24:06 AM
    for entry in self._search_request(
11:24:06 AM
  File "/usr/lib/python3/dist-packages/ansible_collections/microsoft/ad/plugins/plugin_utils/_ldap/client.py", line 348, in _search_request
11:24:06 AM
    self._valid_result(res.result, "search request failed")
11:24:06 AM
  File "/usr/lib/python3/dist-packages/ansible_collections/microsoft/ad/plugins/plugin_utils/_ldap/client.py", line 411, in _valid_result
11:24:06 AM
[WARNING]:  * Failed to parse
11:24:06 AM
    raise LDAPResultError(msg, result)
11:24:06 AM
/tmp/semaphore/inventory_2147483633/microsoft.ad.ldap.yml with yaml plugin:
11:24:06 AM
Plugin configuration YAML file, not YAML inventory
11:24:06 AM
  File "/usr/lib/python3/dist-packages/ansible/inventory/manager.py", line 293, in parse_source
11:24:06 AM
    plugin.parse(self._inventory, self._loader, source, cache=cache)
11:24:06 AM
  File "/usr/lib/python3/dist-packages/ansible/plugins/inventory/yaml.py", line 114, in parse
11:24:06 AM
    raise AnsibleParserError('Plugin configuration YAML file, not YAML inventory')
11:24:06 AM
[WARNING]:  * Failed to parse
11:24:06 AM
/tmp/semaphore/inventory_2147483633/microsoft.ad.ldap.yml with ini plugin:
11:24:06 AM
Invalid host pattern 'plugin:' supplied, ending in ':' is not allowed, this
11:24:06 AM
character is reserved to provide a port.
11:24:06 AM
  File "/usr/lib/python3/dist-packages/ansible/inventory/manager.py", line 293, in parse_source
11:24:06 AM
    plugin.parse(self._inventory, self._loader, source, cache=cache)
11:24:06 AM
  File "/usr/lib/python3/dist-packages/ansible/plugins/inventory/ini.py", line 137, in parse
11:24:06 AM
    raise AnsibleParserError(e)
11:24:06 AM
[WARNING]: Unable to parse
11:24:06 AM
/tmp/semaphore/inventory_2147483633/microsoft.ad.ldap.yml as an inventory
11:24:06 AM
source
11:24:06 AM
[WARNING]: No inventory was parsed, only implicit localhost is available
11:24:06 AM
[WARNING]: provided hosts list is empty, only localhost is available. Note that
11:24:06 AM
the implicit localhost does not match 'all'
11:24:06 AM
Loading callback plugin default of type stdout, v2.0 from /usr/lib/python3/dist-packages/ansible/plugins/callback/default.py
11:24:06 AM
Skipping callback 'default', as we already have a stdout callback.
11:24:06 AM
Skipping callback 'minimal', as we already have a stdout callback.
11:24:06 AM
Skipping callback 'oneline', as we already have a stdout callback.
11:24:06 AM
11:24:06 AM
PLAYBOOK: ping.yml *************************************************************
11:24:06 AM
Positional arguments: ping.yml
11:24:06 AM
verbosity: 4
11:24:06 AM
remote_user: usows
11:24:06 AM
connection: smart
11:24:06 AM
timeout: 10
11:24:06 AM
ask_pass: True
11:24:06 AM
become_method: sudo
11:24:06 AM
tags: ('all',)
11:24:06 AM
inventory: ('/tmp/semaphore/inventory_2147483633/microsoft.ad.ldap.yml',)
11:24:06 AM
extra_vars: ('{"MICROSOFT_AD_LDAP_PASSWORD":"password","MICROSOFT_AD_LDAP_USERNAME":"username","semaphore_vars":{"task_details":{"id":2147483633,"url":null,"username":"admin"}}}',)
11:24:06 AM
forks: 5
11:24:06 AM
1 plays in ping.yml
11:24:06 AM
11:24:06 AM
PLAY [all] *********************************************************************
11:24:06 AM
skipping: no hosts matched
11:24:06 AM
11:24:06 AM
PLAY RECAP *********************************************************************
11:24:06 AM

Manual installation - system information

Linux hq-mng-06 6.1.0-31-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.128-1 (2025-02-07) x86_64 GNU/Linux

Configuration

No response

Additional information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant