Hey all,
i trying to write a idempotent user role, where basically on every run is
checked if the non-system present_users is right.
Now i want to compare my list of user in vars with the present_users.
Here are my user vars:
### ->
users:
- username: ajaeger
groups: ['...']
- username: vagrant
groups: ['...']
- username: slayer
groups: ['...']
### <-
here is my task:
### ->
- name: Get list of all users
shell: "awk -F: '$3 >= 1000 && $3 < 2 {print $1}' /etc/passwd"
register: existing_users
### <-
now i want to:
### ->
- user: name="{{ item }}" state=absent remove=yes
with_items: "{{ to_be_installed_users | difference(existing_users) }}"
### <-
Any suggestions, would be greatly appreciated!
Cheers,
Alex
--
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/db3aa0ba-8eae-49cf-8ffe-ae6dafdb5132%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.