ok I have been working with the user module for the last week. I really want to like ansible because it does not have any additional client requirements except ssh. The problem I am having is that I am getting inconsistent results when using the user module.
I add in the user to the play, and most of the time if I add a new user it will create it, but if I change the comment, or password, or shell or anything like that it is very unpredictable if it actually works, but it most likely will not work and will just give me the
: ok=2 changed=0 unreachable=0 failed=0
for all servers after a change was made to a play.
Example play file
---
- hosts: serverone:servertwo
sudo: yes
tasks:
- name: add local user
user: name=newguy comment="first last" uid=2222 group=users home=/home/newguy shell=/bin/bash password=$6$rounds=40000$SkYFjKIU7FhnFu2B$jGUr0hLkBeIB5Oi6kZyEcos3mwT78DfsW9LhDdd14Kx/T/VzYyyyyy state=absent update_password=always force=yes
user: name=testtwo comment="test guy" uid=5002 group=users home=/home/testtwo shell=/bin/bash password=$6$rounds=40000$3K4vP/lTWYvxKbLd$./c2g.TLNOVaXfyJsDPBCVMGWP/0tVCESX0IhdHUCuxQba2MUPwQLrqFUaKIfhkXsFqB13l0. state=present update_password=always force=yes
user: name=testthree comment="test guy" uid=5003 group=users home=/home/testthree shell=/bin/bash password=$6$rounds=40000$3K4vP/lTWYvxKbLd$./c2g.TLNOVaXfyJsDPBCVMGWP/0tVCESX0IhdH4xjQbua72jMHUsPGwQLrqFUaKIfhkXsFqB13l0. state=present update_password=always force=yes
user: name=testfour comment="test guy" uid=5004 group=users home=/home/testfour shell=/bin/bash password=$6$rounds=40000$3K4vP/lTWYvxKbLd$./c2g.TLNOVaXfyJsDPBCVMGWP/0tVCESX0IhdH4emCuxQua2jMHUsPGwQLrqFUaKIfhkXsFqB13l0. state=present update_password=always force=yes
user: name=testfive comment="test guy" uid=5005 group=users home=/home/testfive shell=/bin/bash password=$6$rounds=40000$3K4vP/lTWYvxKbLd$./c2g.TLNOVaXfyJsDPBCVMGWP/0tVCESX0IhdH4eu72jMHUsPGwQLrqFUaKIfhkXsFqB13l0. state=present update_password=always force=yes
user: name=testsix comment="test what" uid=5006 group=users home=/home/testsix shell=/bin/bash password=$6$rounds=40000$3K4vP/lTWYvxKbLd$./c2g.TLNOVaXfyJsDPBCVMGWP/0tVCESX0IhdH4emUa72jMHUsPGwQLrqFUaKIfhkXsFqB13l0. state=present update_password=always force=yes
user: name=testseven comment="test seven" uid=5007 group=users home=/home/testseven shell=/bin/bash password=$6$rounds=40000$3K4vP/lTWYvxKbLd$./c2g.TaXfyJsDPBCVMGWP/0tVCESX0IhdH4emU8CQbua72jMHUsPGwQLrqFUaKIfhkXsFqB13l0. state=present update_password=always force=yes
Am I missing something, because according to the user doc the only field that is a requirement is "name" so ansible should be keying off that field, and all other fields should be able to change.
I have tried removing all test* accounts from the systems and then run the play and one of two of the seven accounts are actually added back.