Skip to content

ansible handlers from import_tasks marked as failure #6537

@klepiz

Description

@klepiz

Describe the bug
It appears that MegaLinter does not properly handle Ansible handlers imported using the import_tasks directive.

When attempting to import handlers as shown below:

Image

After some investigation, the following potential workarounds were identified:

  • Ignore the rule triggering the false positive.
  • Refactor the playbook into a role, so the handlers are imported as /handlers/main.yml.
  • Define the handlers directly within the playbook instead of importing them.

To Reproduce

  1. Create an Ansible playbook with a separate handlers file.
  2. Import the handlers file into the playbook using import_tasks, for example:
  handlers:
    - import_tasks: ./handlers/main.yml
  1. Run MegaLinter against the playbook.

Expected behavior
MegaLinter should correctly recognize and validate handlers imported via import_tasks, rather than raising an error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions