How to call a tasklist from a module ?

15 views
Skip to first unread message

Jan Goyvaerts

unread,
Jun 22, 2022, 4:35:43 AM6/22/22
to Ansible Project
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 !


Brian Coca

unread,
Jun 22, 2022, 10:00:10 AM6/22/22
to Ansible Project
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.



--
----------
Brian Coca

Reply all
Reply to author
Forward
0 new messages