User updated every single run

I have one machine that every time I run Ansible it keeps updating the same user.

No other machine has the problem. Thought maybe it was the user ended up somehow in an inconsistent state… Deleted the user, including it’s home directory.
Did not help… same is still happening.

ansible 1.6 (devel ae29e43f93) last updated 2014/04/19 17:36:26 (GMT -400)

This is the task

  • name: Create user in FreeBSD systems
    user: home=/home/{{item.uname}} name={{item.uname}} shell={{item.shell}} state=present password={{item.passwd}} groups=wheel
    when: ansible_os_family == “FreeBSD”
    with_items: AdminUsers

This is the output from -vvv

TASK: [admin_users | Create user in FreeBSD systems] **************************
<10.1.1.95> ESTABLISH CONNECTION FOR USER: root
<10.1.1.95> REMOTE_MODULE user home=/home/francisco name=francisco shell=/usr/local/bin/zsh state=present password=VALUE_HIDDEN groups=wheel
<10.1.1.95> EXEC [‘ssh’, ‘-C’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=2222’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘ConnectTimeout=10’, ‘10.1.1.95’, “/bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1401002098.12-52400671984647 && echo $HOME/.ansible/tmp/ansible-tmp-1401002098.12-52400671984647’”]
<10.1.1.95> PUT /tmp/tmpchs1V7 TO /root/.ansible/tmp/ansible-tmp-1401002098.12-52400671984647/user
<10.1.1.95> EXEC [‘ssh’, ‘-C’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=2222’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘ConnectTimeout=10’, ‘10.1.1.95’, “/bin/sh -c ‘/usr/local/bin/python2.7 /root/.ansible/tmp/ansible-tmp-1401002098.12-52400671984647/user; rm -rf /root/.ansible/tmp/ansible-tmp-1401002098.12-52400671984647/ >/dev/null 2>&1’”]
changed: [pull.natserv.net] => (item={‘passwd’: ‘$6$rounds=100000$uXRZS5W3uZSr0E8i$14subthKb62fHlNq61.cjs1xvrcHX/9Whk4jxT.jBybZsGb3IQTLudQbmYnc192wok0HMVosWyZ3Szdkpmv0t.’, ‘uname’: ‘francisco’, ‘shell’: ‘/usr/local/bin/zsh’, ‘francisco’: None}) => {“append”: false, “changed”: true, “comment”: “User &”, “group”: 1001, “groups”: “wheel”, “home”: “/home/francisco”, “item”: {“francisco”: null, “passwd”: “$6$rounds=100000$uXRZS5W3uZSr0E8i$14subthKb62fHlNq61.cjs1xvrcHX/9Whk4jxT.jBybZsGb3IQTLudQbmYnc192wok0HMVosWyZ3Szdkpmv0t.”, “shell”: “/usr/local/bin/zsh”, “uname”: “francisco”}, “move_home”: false, “name”: “francisco”, “password”: “NOT_LOGGING_PASSWORD”, “shell”: “/usr/local/bin/zsh”, “state”: “present”, “uid”: 1001}

The bit that returns “changed” may not be fully cognizant of all the parameters.

I’m pretty sure password is one of those attributes, in changing the password, it may report changed every time.

Are you just trying to get the status to report changed=0 or are there updates you don’t want to happen? If so, please specify which.

The bit that returns “changed” may not be fully cognizant of all the parameters.
I’m pretty sure password is one of those attributes, in changing the password, it may report changed every time.

But if that was the case shouldn’t this happen to other hosts? This is the only host that has that behavior.
i have several other FreeBSD machines in the same host group and none of them has, or has ever had, that behavior. Even this same machine didn’t have this behavior before.

Are you just trying to get the status to report changed=0

Ideally yes…

or are there updates you don’t want to happen? If so, please specify which.

As far as I can tell the task is working fine and doing exactly what it should be doing. The user exists, the key is installed, the password is correct…

Tried deleting the user (twice) including deleting the home folder. Both times the user got re-created properly.

If you can do some debugging using the “test_module” script and determine why this one host is reporting changed every time it may be helpful.

I’d say file a ticket but it seems like it may be hard to reproduce if it’s just this one host – maybe something else is modifying it? (Had to ask)

If you can do some debugging using the “test_module” script and determine why this one host is reporting changed every time it may be helpful.

This one https://github.com/ansible/ansible/blob/devel/hacking/test-module ?
Any links/documentation on how to run it?

I’d say file a ticket

Trying to at least provide more info before doing a ticket… otherwise it may not be of much help… if it is something that only happens, reliably, in a single machine…

maybe something else is modifying it? (Had to ask)

Don’t believe that to be the case. Specially when I would literally re-run the process several times after each other. Can’t imagine anyhing that would e changing my user files/password that quickly… plus I am the only person that uses the machine in any form of regular bases.

Another user had opened an issue for a very similar error, however it turned out to be something in their environment. My suggestion to them was to compare the output of “getent passwd ” before and after a run to see what it might be changing each time. Beyond that, it might be something home directory related, perhaps caused by some other part of the play?