user module doesn't work properly

Hello Ansible Community,

I have a task described below, and it works fine if the user account has been managed by Ansible since the moment of the user account creation. However, this task always ends with “changed” status when I try to manage an existing user account on an existing server. Has anyone seen the same issue? Or could it be something local to my server? The OS is RHEL 6.7, and the Ansible version is 1.9.4.

- name: create user myuser
  user:
    name: myuser
    comment: my test user
    home: /home/myuser
    uid: 12345
    groups: users
    password: encrypted_password
    update_password: on_create

Thank you,
Koji

Hi,

Why did you use groups when you have only one group ?
I think you should use "group" instead of "groups"

This is this issue
https://github.com/ansible/ansible-modules-core/issues/1118
A part of the problem is when you put your main group in the groups (with a s) list

Regards,

Thank you so much, Jean-Yves. That's exactly the issue I had. I used
"groups" because the first user account I tried to maintain had
multiple groups to belong to, and I ignorantly copied and pasted it
without caring much about the "s".

Now I know what's behind. Thanks so much again!

Bests,
Koji