robertdebock / ansible-role-users

The purpose of this role is to add users and groups on your system.
https://robertdebock.nl/
Apache License 2.0
42 stars 27 forks source link

ERROR! this task 'ansible.builtin.import_tasks' has extra params... when running playbook with the role #22

Closed falkheiland closed 2 years ago

falkheiland commented 2 years ago

Describe the bug

Error using the role in my playbook

Playbook

playbook:

---
- hosts: redacted

  tags:
    - user

  vars:
    ansible_user: "{{ base_user }}"
    ansible_password: "{{ base_user_password }}"
    ansible_sudo_pass: "{{ base_sudo_pass }}"

  become: true

  roles:
    - robertdebock.users

  tasks:
    - name: "Change password for {{ default_user }}"
      user:
        name: "{{ default_user }}"
        password: "{{ default_user_password | string | password_hash('sha512', 'A512') }}"

requirements.yml (excerpt)

- src: robertdebock.users
  version: 5.4.0
# ansible-galaxy list -p ./roles/ | grep 'robertdebock.users'
- robertdebock.users, 5.4.0

Output

# ansible-playbook playbook.yml -i inventories/redacted/ --vault-password-file ~/.vault_pass.txt
ERROR! this task 'ansible.builtin.import_tasks' has extra params, which is only allowed in the following modules: ansible.windows.win_command, shell, win_shell, include_vars, ansible.windows.win_shell, import_role, script, meta, include, include_tasks, group_by, raw, include_role, command, import_tasks, win_command, add_host, set_fact

The error appears to be in '/git/ansible/roles/robertdebock.users/tasks/main.yml': line 4, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

- name: import assert.yml
  ^ here

vscode linter of extension Ansible v0.7.1 JSON Schema Ansible Tasks File on the main.yml (lines):

4 - name: import assert.yml
5   ansible.builtin.import_tasks: assert.yml
6   run_once: yes
7   delegate_to: localhost

4: Missing property "action".yaml-schema: TaskModel | BeremothTaskModel 5: Property ansible.builtin.import_tasks is not allowed.yaml-schema: TaskModel 6: Incorrect type. Expected "boolean".yaml-schema: Run Once | BeremothTaskModel

Environment

falkheiland commented 2 years ago

after extended search for that eror and not finding something, i decided to completely reinstall my control machine. the error is gone now, i guess althoug showing ansible 2.10 installed, that an older version was still active. i will close the ticket now.

robertdebock commented 2 years ago

Thanks for leaving his information for others. The error you encountered are unknown to me.