Assuming that what you want to do is create a number of groups listed
in the grouplist variable, and then create the users listed in the
users variable, where each user is member of all groups in the
grouplist variable, your second task should be one of the following
(Ansible 2.3 can accept lists directly in "groups" attribute):
- name: Create users from vars users (Ansible 2.3+)
user:
name: "{{ item }}"
state: present
groups: "{{ grouplist }}"
with_items: "{{ userlist }}"
- name: Create users from vars users (Ansible <2.3)
user:
name: "{{ item }}"
state: present
groups: "{{ grouplist | join(',') }}"
with_items: "{{ userlist }}"
Best regards
--
Branko Majic
XMPP:
bra...@majic.rs
Please use only Free formats when sending attachments to me.
Бранко Мајић
XMPP:
bra...@majic.rs
Молим вас да додатке шаљете искључиво у слободним форматима.