ZzYMaL4E
2017-01-11 21:26:03

- name: User creation
user: name="{{item.username}}"
group="{{item.username if users_create_per_user_group
else item.group}}"
groups="{{item.groups | join(',')}}"
shell="{{item.shell if item.shell is defined else users_default_shell}}"
comment="{{item.name}}"
uid="{{item.uid}}"
home="{{item.home if item.home is defined else []}}"
password="{{ item.password if item.password is defined else '!' }}"
tags: ['users','configuration']

ok: [someserver] => (item={u'username': u'someuser', **u'group': [u'wordpress']**, u'name': u'somefirstname somelastname', u'ssh_key': [u'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAakld;aadjkl;adAFNZY3yaLIiWftb+8dHx2J8C7pPEmNY0M+yc8uI+UX9+klauHiaat3THCYlbZPdIaSYeXgkXCPTY+6xdexQkvNPu1vLkibgwIug4MS/4BDFgqokHx0wlrEn1MxI4UWxmrNGlJq4OEf5Wq27Pr7adb3eKk90ZhUUW0hr5Cv+f4wPNsDV/+h7TGg1VeYNk3ogbUlfTeiINE0qhLFw/f+UgL5H/UYkQpzHF6tnL4tGRHsjsqsW3Q+a7SB5933S8Bo6i28mLa/mxQKiGo304Y/Qv9WArPg+URgqsW5J4uwffjO+gLoq2lb5kf0o3ceuK5OZKYt3lBlWnTXPpV1'], u'groups': [u'someuser', u'apache', u'sftpusers'], u'password': u'$6$saltsalt$JR3U1NjYpkxDB0ngkadjkl;adjkl;afdjkl;dakjda/8tSVaoSEa2.4CT2MFyU71w20', u'uid': 2101})

- name: Debug users_create_per_user_group
debug: var=users_create_per_user_group

- name: User creation
user: name="{{item.username}}"
group="{{item.username if users_create_per_user_group
else (item.group if item.group is string else item.group[0]) }}"
groups="{{item.groups | join(',')}}"
shell="{{item.shell if item.shell is defined else users_default_shell}}"
comment="{{item.name}}"
uid="{{item.uid}}"
home="{{item.home if item.home is defined else []}}"
password="{{ item.password if item.password is defined else '!' }}"
tags: ['users','configuration']