#                                               ___            _        
#   ___ ___  _ __ ___  _ __ ___   ___  _ __    / / |_ __ _ ___| | _____ 
#  / __/ _ \| '_ ` _ \| '_ ` _ \ / _ \| '_ \  / /| __/ _` / __| |/ / __|
# | (_| (_) | | | | | | | | | | | (_) | | | |/ / | || (_| \__ \   <\__ \
#  \___\___/|_| |_| |_|_| |_| |_|\___/|_| |_/_/   \__\__,_|___/_|\_\___/
#
# create-user
#
- name: create-user | Each group should be created
  group: >
    name={{ item.group }}
    gid={{ item.gid }}
    state=present
  with_items: unixusers

- name: create-user | Each user should be created
  user: >
    name={{ item.username }} 
    password={{ item.password }}
    uid={{ item.uid }}
    group={{ item.group }} 
    shell={{ item.shell }}
    home={{ item.home }}
    createhome=yes
    state=present
  with_items: unixusers


#                                               ___            _        
#   ___ ___  _ __ ___  _ __ ___   ___  _ __    / / |_ __ _ ___| | _____ 
#  / __/ _ \| '_ ` _ \| '_ ` _ \ / _ \| '_ \  / /| __/ _` / __| |/ / __|
# | (_| (_) | | | | | | | | | | | (_) | | | |/ / | || (_| \__ \   <\__ \
#  \___\___/|_| |_| |_|_| |_| |_|\___/|_| |_/_/   \__\__,_|___/_|\_\___/
#
# create-user
#
- name: create-user | Each group should be created(1)
  group: >
    name={{ item.group }}
    gid={{ item.gid }}
    state=present
  with_items: unixusers

- name: create-user | Each group should be created(2)
  group: name={{ item.groups }} state=present
  with_items: unixusers

- name: create-user | Each user should be created
  user: >
    name={{ item.username }} 
    password={{ item.password }}
    uid={{ item.uid }}
    group={{ item.group }} 
    shell={{ item.shell }}
    home={{ item.home }}
    createhome=yes
    state=present
  with_items: unixusers


Create group: the value of groups
Create group: the value of groups
