ansible-collections / community.general

Ansible Community General Collection
https://galaxy.ansible.com/ui/repo/published/community/general/
GNU General Public License v3.0
821 stars 1.51k forks source link

ldap_entry: Error libldap2 #9030

Open nodje opened 2 days ago

nodje commented 2 days ago

Summary

this is probably heavily environment related, so I´ll as precise as possible on this level.

The error shows up when using community.general.ldap_entry : ImportError: libldap_r-2.4.so.2: cannot open shared object file: No such file or directory

Issue Type

Bug Report

Component Name

ldap_entry

Other information that's not the component name

ubuntu 20.04.6 LTS gcc-11 installed from ppa:ubuntu-toolchain-r/test additional packages: build-essential libsasl2-dev libldap2-dev libssl-dev Python 3.12.6 venv

python requirements.txt: ansible-core==2.17.5 ansible-lint python-ldap==3.4.4

Ansible Version

$ ansible --version
ansible [core 2.17.5]
  config file = /home/shared/projects/ldap-keycloak-poc/ansible.cfg
  configured module search path = ['/home/jseurin01/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/shared/projects/ldap-keycloak-poc/.venv/lib/python3.12/site-packages/ansible
  ansible collection location = /home/jseurin01/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/shared/projects/ldap-keycloak-poc/.venv/bin/ansible
  python version = 3.12.6 (main, Sep  6 2024, 19:03:47) [GCC 11.4.0] (/home/shared/projects/ldap-keycloak-poc/.venv/bin/python3.12)
  jinja version = 3.1.4
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general
Collection        Version
----------------- -------
community.general 9.5.0

Configuration

$ ansible-config dump --only-changed
CONFIG_FILE() = /home/shared/projects/ldap-keycloak-poc/ansible.cfg
PAGER(env: PAGER) = less

OS / Environment

libldap2-dev | 2.4.49+dfsg-2ubuntu1 is the version installed

This is the location of the libldap on the machine:

lrwxrwxrwx 1 root root     18 Jan 25  2024 /usr/lib/x86_64-linux-gnu/libldap-2.4.so.2 -> libldap_r-2.4.so.2
lrwxrwxrwx 1 root root     11 Jan 25  2024 /usr/lib/x86_64-linux-gnu/libldap.a -> libldap_r.a
lrwxrwxrwx 1 root root     24 Jan 25  2024 /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2 -> libldap_r-2.4.so.2.10.12
-rw-r--r-- 1 root root 339472 Jan 25  2024 /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2.10.12
-rw-r--r-- 1 root root 683156 Jan 25  2024 /usr/lib/x86_64-linux-gnu/libldap_r.a
lrwxrwxrwx 1 root root     24 Jan 25  2024 /usr/lib/x86_64-linux-gnu/libldap_r.so -> libldap_r-2.4.so.2.10.12
lrwxrwxrwx 1 root root     12 Jan 25  2024 /usr/lib/x86_64-linux-gnu/libldap.so -> libldap_r.so

Steps to Reproduce

  - name: Make sure we have a parent entry for users
       community.general.ldap_entry:
       **

Expected Results

it should run the task

Actual Results

The full traceback is:
Traceback (most recent call last):
  File "/tmp/ansible_community.general.ldap_entry_payload_wv8ttlex/ansible_community.general.ldap_entry_payload.zip/ansible_collections/community/general/plugins/modules/ldap_entry.py", line 158, in <module>
    import ldap.modlist
  File "/home/shared/projects/ldap-keycloak-poc/.venv/lib/python3.12/site-packages/ldap/__init__.py", line 34, in <module>
    import _ldap
ImportError: libldap_r-2.4.so.2: cannot open shared object file: No such file or directory
fatal: [localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "attributes": {},
            "bind_dn": "cn=admin,dc=example,dc=com",
            "bind_pw": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "ca_path": null,
            "client_cert": null,
            "client_key": null,
            "dn": "ou=users,dc=example,dc=com",
            "objectClass": [
                "organizationalUnit"
            ],
            "recursive": false,
            "referrals_chasing": "anonymous",
            "sasl_class": "external",
            "server_uri": "ldap://openldap-upstream:31389",
            "start_tls": false,
            "state": "present",
            "validate_certs": true,
            "xorder_discovery": "auto"
        }
    },
    "msg": "Failed to import the required Python library (python-ldap) on M093-2156858's Python /home/shared/projects/ldap-keycloak-poc/.venv/bin/python3.12. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"
}

Code of Conduct

ansibullbot commented 2 days ago

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot commented 2 days ago

Files identified in the description: None

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot commented 2 days ago

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot commented 2 days ago

cc @jtyr click here for bot help