freeipa / ansible-freeipa

Ansible roles and modules for FreeIPA
GNU General Public License v3.0
489 stars 232 forks source link

"user_add_manager: user test: no such entry" #1163

Closed Codehunter-py closed 6 months ago

Codehunter-py commented 10 months ago

Hi

I am trying to update user details in IPA systems, and get an error "msg": "user_add_manager: user test: no such entry".

My task file looks like below:

- name: Ensure user is present but don't reset password if already exists
  freeipa.ansible_freeipa.ipauser:
    name: "{{ item.name }}"
    first: "{{ item.first }}"
    last: "{{ item.last }}"
    displayname: "{{ ipauser_displayname }}"
    fullname: "{{ ipauser_fullname }}"
    email: "{{ item.email }}"
    ipaadmin_password: "{{ ipaadmin_password }}"
    random: yes
    update_password: on_create
    state: present
    principal: "{{ principal | default(omit) }}"
    uid: "{{ item.uid | default(omit) }}"
    gid: "{{ item.gid | default(omit) }}"
    principalexpiration: "{{ item.principalexpiration | default(omit) }}"
    passwordexpiration: "{{ item.passwordexpiration | default(omit) }}"
    sshpubkey: "{{ item.sshpubkey | default(omit) }}"
    title: "{{ item.title | default(omit) }}"
    phone: "{{ item.phone | default(omit) }}"
    # password: "{{ generate_passwd }}" # "{{ item.temp_passwd | default(omit) }}"
    initials: "{{ item.initials | default(omit) }}"
    gecos: "{{ item.gecos | default(omit) }}"
    city: "{{ item.city | default(omit) }}"
    userstate: "{{ item.userstate | default(omit) }}"
    street: "{{ item.street | default(omit) }}"
    postalcode: "{{ item.postalcode | default(omit) }}"
    mobile: "{{ item.mobile | default(omit) }}"
    pager: "{{ item.pager | default(omit) }}"
    fax: "{{ item.fax | default(omit) }}"
    orgunit: "{{ item.orgunit | default(omit) }}"
    manager: "{{ item.manager | default(omit) }}"
    carlicense: "{{ item.carlicense | default(omit) }}"
    userauthtype: "{{ item.userauthtype | default(omit) }}"
    userclass: "{{ item.userclass | default(omit) }}"
    departmentnumber: "{{ item.departmentnumber | default(omit) }}"
    employeenumber: "{{ item.employeenumber | default(omit) }}"
    employeetype: "{{ item.employeetype | default(omit) }}"
    preferredlanguage: "{{ item.preferredlanguage | default(omit) }}"
    noprivate: "{{ item.noprivate | default(omit) }}"
    nomembers: "{{ item.nomembers | default(omit) }}"
  loop: "{{ freeipa_users }}"
  register: ipauser_result

However I see in the output:

TASK [createipauser : Ensure user is present but don't reset password if already exists] ***********************************************************************
failed: [dus1-app-019p] (item={****SKIPPED***"USER DETAILS}, "msg": "user_add_manager: user test: no such entry"}

FYI, I have modified the output in order to hide the private data.

t-woerner commented 10 months ago

Are you trying to set an existing user as the manager?

Codehunter-py commented 10 months ago

@t-woerner No, I am trying to update existing user's details such as address and phone number. I believe that ipauser module can also update user details in IPA systems, and here I also set update_password: on_create to make sure that user's passwd is not resetted.

t-woerner commented 10 months ago

@Codehunter-py user_add_manager: user test: no such entry states that the user test that should be set as the manager does not exist. Are you using test data?

Codehunter-py commented 10 months ago

@t-woerner Hi I am using the real data that is already in the IPA systems. But I want to alternate the user details that already in the system. The task runs without error in check mode. However it fails when check_mode is false. What could be reason here?

t-woerner commented 10 months ago

@Codehunter-py Please verify that you are not trying to set a not existing user as the manager for another user. Does the user test really exist?

Codehunter-py commented 9 months ago

@t-woerner Hi, Yes it does exist.

Codehunter-py commented 6 months ago

Different versions on a managed node was originally causing the issue to arise.