0
votes

I am receiving the following error message:

fatal: [127.0.0.1]: FAILED! => {"failed": true, "reason": "ERROR! no action detected in task\n\nThe error appears to have been in '/etc/ansible/roles/user-manage/tasks/add-users.yml': line 8, column 4, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: Add multiple users\n ^ here\n"}

Here is my playbook that it is complaining about:

 - name: Add new group if it doesn't exist already
   group:
    name: "{{ item }}"
   with_items:
    - "{{ group_add }}"
   when: group_add is defined

 - name: Add multiple users
   users:
    name: "{{ item.users_name }}"
    comment: "{{item.users_comment }}"
    uid: "{{ item.users_uid }}"
    group: "{{ item.users_group }}"
    groups: "{{ item.users_groups }}"
    shell: "{{ item.users_shell }}"
    state: "{{ item.users_state }}"
    append: yes
   with_items:
     - "{{ users_add }}"

 - name: Add SSH key for user
   authorized_key:
    user: "{{ item.name }}"
    key: "{{ lookup('file', '/etc/ansible/files/keys/{{ item.users_name }}.pub') }}"
   with_items:
    - "{{ users_add }}"

This was just working last night. I'm unsure of what is causing this. Any ideas?

2
I would make sure users_add contains the items you think it does. I would run: - debug: var=item with_items: users_add and make sure you see what you expect - Petro026

2 Answers

2
votes

There is no users module. The correct name is user. Remove the s and it will work.

0
votes

I was having the same error on the first line (also the name line) of a playbook. It turned out that I was using an older version of Ansible that was not compatible with some of the newer modules called in my playbook. Once I updated Ansible to the most current version, my playbook ran no problem. Hopefully this helps someone else.