Ansible user_module exit with rc: -25 if trying to create user with UID provided from Active Directory (AD) domain controller (DC).


- name: Configure local user for example.com
    name: example
    password: "{{ lookup('file', '/tmp/example_at_host.example.com') }}"
    system: yes         # Defaults to no
    createhome: yes     # Defaults to yes
    uid: '1234567890'   # Default user id of example
    group: '1234500513' # Default group "example users"
    groups: wheel       # Empty by default, here, provide root rights via sudoers wheel
    shell: /bin/bash    # Defaults to /bin/bash
    state: present
  when: ansible_domain == "example.com"
  tags: install,user


TASK [Configure local user for example.com] *****************************************************************************
fatal: [host.example.com]: FAILED! => changed=false
  msg: ''
  name: example
  rc: -25

Even if trying to create the user manually on CLI

useradd --system --create-home --uid 1234567890 --gid 1234500513 --groups wheel --shell /bin/bash --comment "Example User" example

it fails.

File size limit exceeded (core dumped)

How to resolve this and get user created with same ID as in AD?

1 Answer 1


After research it turned out that it will be necessary to set a larger file size limit via Ansible module pam_limits. The file size limit should larger than UID * 292 bytes.

- name: Add or modify soft fsize limits for root domain (for /var/log/lastlog)
    domain: root
    limit_type: soft
    limit_item: fsize
    value: '360493823880' # uid * 292
  when: ansible_domain == "example.com"
  tags: install,user,system

Credits to

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.