ERROR! included task files must contain a list of tasks

Morning -

I’m currently running a test on the suing variable with the file. I’ve made my set-up for the playbook using galaxy-init

Can someone help explain the error below?

ERROR! included task files must contain a list of tasks

The error appears to be in ‘/etc/ansible/roles/cassandra_version_upgrade_dev/tasks/test.yml’: line 2, column 1, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

Hi Yangaz,
in second line of your playbook its shd be bracket like this “/var/main.yml”
For your reference pls check this out :- https://stackoverflow.com/questions/36620963/dynamic-file-name-in-vars-files

if its error then i wish i could learn about ansible variables and i could help u.

I think the variable declaration is causing this issue. For a role, you may use, ‘include_vars’ module and declare the same like,

tasks:

  • name:
    include_vars:
    file: ‹path›

Try this.