Hi there,
I’m trying to setup an users role so that it will create users. This is not really difficult, but I only want to create users on a host if you are in a group.
I’ve got the following vars:
users:
- name: “Werner Dijkerman”
state: present
uid: 1000
gid: 1000
groups: - admin
- monitor
users_group:
- admin
And the following task:
- name: Create user task
user: name=“{{ item.name }}”
state=“{{ item.state }}”
with_items: “{{ users }}”
when: users_group in item.groups
When I run the playbook, it is “skipping” the “Create user task”. I know I do miss some arguments in the user task. I would expect an error message instead of skipping the task.
So when you are in the “admin” group, it will create you on the host.
But this won’t work. What am I missing or doing wrong?
Kind regards,
Werner