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

community.general.ldap_entry module not adding new entry even no entry is present in ldap server, #9235

Open
1 task done
d0020002 opened this issue Dec 10, 2024 · 3 comments
Labels
bug This issue/PR relates to a bug module module plugins plugin (any type)

Comments

@d0020002
Copy link

Summary

When I am trying to add an entry even if entry is not present, it is still saying not adding with just output "{changed: false, failed: false}

I am using below task to add the entry

- name: Create LDAP Entry with Attributes
  community.general.ldap_entry:
    dn: "cn={{ ldap_user_cn }},nismapname={{ nismapname }},ou={{ ou }},{{ automount_base_dn }}"
    objectClass:
      - top
      - nisObject
    attributes:
      cn: "{{ ldap_user_cn }}"
      nismapName: "{{ nismapname }}"
      nisMapEntry: "{{ nis_map_entry }}"
    state: present
    bind_dn: "{{ ldap_bind_dn }}"
    bind_pw: "{{ ldap_bind_pw }}"
    server_uri: "ldap://{{ ldap_server }}"
  register: add_entry_result

If i change the state absent, it is working fine for deleting the entries, but it is not able to add new entry

Issue Type

Bug Report

Component Name

community.general.ldap_entry module

Ansible Version

ansible [core 2.15.13]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/d/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/d/.local/lib/python3.9/site-packages/ansible
ansible collection location = /home/d/.ansible/collections:/usr/share/ansible/collections
executable location = /home/a-dkushwah/.local/bin/ansible
python version = 3.9.18 (main, Oct 4 2024, 00:00:00) [GCC 11.4.1 20231218 (Red Hat 11.4.1-3)] (/usr/bin/python3)
jinja version = 3.1.4
libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general

Collection        Version
----------------- -------
community.general 10.1.0 

\\

### Configuration

```console (paste below)
$ ansible-config dump --only-changed
default

OS / Environment

RHEL9

Steps to Reproduce

    - name: Create LDAP Entry with Attributes
      community.general.ldap_entry:
        dn: "cn={{ ldap_user_cn }},nismapname={{ nismapname }},ou={{ ou }},{{ automount_base_dn }}"
        objectClass:
          - top
          - nisObject
        attributes:
          cn: "{{ ldap_user_cn }}"
          nismapName: "{{ nismapname }}"
          nisMapEntry: "{{ nis_map_entry }}"
        state: present
        bind_dn: "{{ ldap_bind_dn }}"
        bind_pw: "{{ ldap_bind_pw }}"
        server_uri: "ldap://{{ ldap_server }}"
      register: add_entry_result

Expected Results

It should create new entry

Actual Results

TASK [Display Result of Adding LDAP Entry] ******************************************************************************************************
ok: [localhost] => {
    "add_entry_result": {
        "changed": false,
        "failed": false,
    }
}

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibullbot
Copy link
Collaborator

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
Copy link
Collaborator

cc @jtyr
click here for bot help

@ansibullbot ansibullbot added bug This issue/PR relates to a bug module module plugins plugin (any type) labels Dec 10, 2024
@russoz
Copy link
Collaborator

russoz commented Dec 12, 2024

Hi @d0020002 thanks for reporting. To assist whoever is going to look into this in the future, could you please state which LDAP service (with version and any other relevant info) you are using?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug module module plugins plugin (any type)
Projects
None yet
Development

No branches or pull requests

3 participants