I am trying to add users belongs to group abc into group xyz. to do this in ansible I am doing following
- name: Get the list of user belongs to abc group
command: lid -g -n abc
register: abc_users
- name: Add user belongs to abc group to xyz group
user: name={{ items }} groups=xyz append=yes
with_items: "{{ abc_users.stdout }}"
But getting following error
fatal: [10.8.17.14]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'items' is undefinedThe error appears to have been in '/home/#/workspace/#/ansible/roles/ubuntu-common/tasks/main.yml': line 26, column 3, but maynbe elsewhere in the file depending on the exact syntax problem.The offending line appears to be:n- name: Add user belongs to sentience group to docker groupn ^ heren"}
Anyone know better way to do this ?
Thanks
