Looks like you may want:

when: users_group[0] in item.groups

You may also just wish to change this:

users_group: admin




On Sun, Dec 14, 2014 at 10:13 AM, Werner Dijkerman <[email protected]>
wrote:
>
> Hi there,
>
> I'm busy with an module for managing users (With public keys) for my work.
>
> I've got the following vars:
>
> users:
>  - name: "Werner Dijkerman"
>    state: present
>    uid: 1000
>    gid: 1000
>    groups:
>      - admin
>      - simple_group
>
> users_group:
>  - admin
>
> And I have the following task:
>
>  - name: Check users state
>    user: name="{{ item.name }}"
>          state="{{ item.state }}"
>    with_items: "{{ users }}"
>    when: users_group in item.groups
>
> When I add the users_group var in an host_group var file (Like
> group_vars/all), the users in that specific group needs te be created on
> the host.
>
> But when I run the playbook, it keeps "skipping".
>
> What am I missing or doing wrong? I tried to use it with "with_subelements"
> but it still keep "skipping"
>
> Kind regards,
>
> Werner
>
> --
> 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/172fcef0-8b37-4366-94ca-7a72b70d3658%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/172fcef0-8b37-4366-94ca-7a72b70d3658%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CA%2BnsWgwqVrZ4TyE_6E_o04SSQ%2BJL3Z%2B9%2BDDTqfF2Bhr9JQ-dzw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to