You are using lists for every key (comment, group, shell, …) whereas with the subelements loop, you can only have a list for the group subkey (as per your task)
So what I’m trying to achive is not possible?
How could I create a set of users using the variable’s-file instead of “hardcoding” them into the task-file?
I think the above loop is not correct for what you want to do. You are using the ‘group’ parameter of the user module, which sets the primary group. So, it will reset it on each loop iteration. Also, you are using a key named ‘group’ with a list value, which seems not to be indicative of what you want to deploy. What is it meant for? Is it meant to be a list of the groups the user must be member of? Then rename it to ‘groups’. Is it meant to be the primary group of the user? Then rename it to ‘primary_group’. In either case, it seems that what you want can be done with a simple ‘with_items’ loop. No need for a ‘with_subelements’ loop. For example:
Another great way of doing it!
What I’m going to do is just a playbook to setup the basic Shinken system. And the Shinken user should only be member of the group shinken.