# How to call a tasklist from a module ?

**URL:** <https://forum.ansible.com/t/how-to-call-a-tasklist-from-a-module/36766>\
**Category:** Ansible Project\
**Created:** [June 22, 2022, 8:35am UTC](https://forum.ansible.com/t/how-to-call-a-tasklist-from-a-module/36766 "2022-06-22T08:35:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jan\_Goyvaerts](https://avatars.discourse-cdn.com/v4/letter/j/13edae/32.png) [@Jan\_Goyvaerts](https://forum.ansible.com/u/Jan_Goyvaerts)\
**Post date:** [June 22, 2022, 8:35am UTC](https://forum.ansible.com/t/how-to-call-a-tasklist-from-a-module/36766/1 "2022-06-22T08:35:43Z")

</div>

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. 🙂

THX !

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [June 22, 2022, 1:58pm UTC](https://forum.ansible.com/t/how-to-call-a-tasklist-from-a-module/36766/2 "2022-06-22T13:58:58Z")

</div>

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.
