Ansible ERROR! unexpected parameter type in action:

Viewed 644

I try to run a role/task, but i cant solve the following error:

ERROR! unexpected parameter type in action: <class 'ansible.parsing.yaml.objects.AnsibleSequence'>

The error appears to be in '/home/<user>/ansible/ilias6/roles/keysAndUsers/tasks/main.yaml': line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

---
- name: createUser and add to sudoer
  ^ here

This is my task:

---
- name: createUser and add to sudoer
  become: yes
  vars_files:
    - /home/<user>/ansible/ilias6/roles/keysAndUsers/lists/userCreateList.yaml
  user:
    name: "{{ item }}"
    groups: "sudo, www-data"
    password: "{{ 'password' | password_hash('sha512', 'mysecretsalt') }}"
    update_password: on_create
    state: present
    shell: /bin/bash
    system: no
    createhome: yes
  loop: "{{ users }}"
  register: useradd
    
- name: change user password upon creation
  shell: chage -d 0 "{{ item.name }}"
  loop: "{{ useradd.results }}"
  when: item.changed

I noticed, if I comment out the section vars_files its fine. But i need the extern variables unfortunately

0 Answers
Related