Hi Guys,
I get an error when I run a playbook, which aims to create new users and set authorized keys for them. The error:
TASK: [create new users] ******************************************************
fatal: [testvm1] => with_items expects a list or a set
fatal: [testvm2] => with_items expects a list or a set
Here's a part of the playbook (the first task fails):
- name: create new users
user: name={{
item.name }} group=wheel append=yes password={{user_password}}
with_items: "{{users}}"
- name: set pub keys
authorized_key: "user={{
item.0.name }} key='{{ lookup('file', item.1) }}'"
with_subelements:
- users
- authorized
- name: set pass expiration
command: /usr/bin/chage -d 0 {{
item.name }}
with_items: "{{users}}"
Here's the var file:
---
wheelsregex: # *%wheel *ALL=\(ALL\) *ALL
user_password: 12345678
users:
- name: test
authorized:
- /etc/ansible/add_users/files/test.pub
- name: test1
authorized:
- /etc/ansible/add_users/files/test1.pub
- name: test2
authorized:
- /etc/ansible/add_users/files/test2.pub
Any idea where's my mistake? I saw that it might be related to ansible version, so mine is 1.9.2.
Regards,
Dimitar