How to call a tasklist from a module ?

Good morning Ansible Community,

I am in the process of developing a collection with modules for reducing complex system configurations to a single task. To that effect I’ve made an “install” module:

  • install:
    name: foo
    version: 1.0.0

The idea is that this is a shortcut to a tasklist or playbook, say install_foo.yml. Also included into the collection.

However, I am a bit at loss how to call/include/… a task list or playbook of the collection from within the Python code of the ‘install’ module.

Can somebody give me pointers on how to do this ? IF possible of course. :slight_smile:

THX !

You don't, only include_tasks/import_tasks can do that and they are
built into the core engine.

This is also discouraged as it removes visibility and auditability
from your playbooks, I recommend using a role instead.