How do I get molecule to follow include_tasks correctly

653 views Asked by At
TASK [Test: Install Test Authentication] ***********************************
fatal: [ubuntu2004]: FAILED! => {"reason": "Could not find or access '/home/test/test.playbook/molecule/default/test.yaml' on the Ansible Controller."}

Molecule handles files and templates fine relative to the .roles folder...why does this not occur for tasks when called via include_tasks :

- name: Install Test Authentication
  include_tasks:
    file: test.yaml
  when: test is defined

Folder structure is pretty simple.

~/playbook
  |___molecule
        |___default
              |___converge.yaml
  |___.roles
        |___ files
        |___ tasks
              |___ main.yaml <- called with no issues
              |___ test.yaml <- will not find when used in case above.

Obviously, there are other files...but my template tasks and file tasks work fine.....following their relative paths but tasks won't, why is this or what am I doing wrong. I can find no documentation and I am sure others have run into the issue, yet all I can find is the following:

https://github.com/ansible-community/molecule/issues/2171 which is about ansible-lint but its the closest thing I could find.

Also, there seems to be a total of 4 locations to discuss/ask questions regarding molecule....so I am not sure which will get answered first.

|TLDR; How do I get molecule to follow include_tasks correctly.

1

There are 1 answers

0
Anihilat On

From what i see you have a wrong role structure.

Molecule folder should be in role folder.

Example structure of molecule role

This is from what you should start. After that recheck file naming. Recently i had common problem and it was, because lack of file extension.