Ansible user module not idempotent when using groups argument

Viewed 515

I encounter that ansible task and ad-hoc command always change when using user module together with argument groups.

ansible --version

ansible 2.8.5
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/etc/ansible/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /bin/ansible
python version = 2.7.16 (default, Dec 12 2019, 23:58:22) [GCC 7.3.1 20180712 (Red Hat 7.3.1-6)]

Example ad-hoc

ansible -c local -i localhost, -m user -a "uid=10001 name=foobar group=person home=/home/foobar state=present groups=person" all

Example playbook task

- name: ensure users are present
  become: true
  user:
    uid: 10001
    name: foobar
    group: person
    groups:
      - person
    home: /home/foobar
    state: present

If I delete the groups property the tasks doesn't change all the time.

Thank you

0 Answers
Related