Finally got a chance to look at this again. Thanks for the pointer Brian
you were spot on, and as a result its all far cleaner now.
---
- hosts: all
gather_facts: no
vars_files:
- ~/.userlist.yml
tasks:
- name: Is user on this system?
action: getent
database=passwd
no_log: True
- name: Reset Password - skips if user not already created
action: user name={{ item.value.name }} state=present
password={{item.value.password}} update_password=always
comment="{{item.value.comment}}"
with_dict: users
when: item.value.name in getent_passwd
On Wednesday, 23 September 2015 18:35:58 UTC+1, Brian Coca wrote:
>
> It might be easier to just run:
>
> - getent: database=passwd
>
> and then make the users conditional on:
>
> - user: name=item.value.name state=present ...
> when: item.value.name in getent_passwd
>
>
> --
> Brian Coca
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/669433b1-316a-4bd3-9855-2e5efd9fc9c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.