Brian Coca
ungelesen,21.06.2022, 11:45:2321.06.22Anmelden, um dem Autor zu antworten
Zum Weiterleiten anmelden
Sie sind nicht berechtigt, Nachrichten in dieser Gruppe zu löschen
Originalnachricht anzeigen
Entweder sind die E-Mail-Adressen für diese Gruppe anonym oder Sie benötigen die Berechtigung zum Ansehen der E-Mail-Adressen der Mitglieder, um die Originalnachricht anzusehen
an Ansible Project
I prefer to keep things simple and obvious, I would keep role imports
to the play, not everyone agrees and many use complex role
hierarchies.
If it is a choice between setting 'dependencies' (which imports a role
from a role) and import_role, I always advise to use the latter.
reasons against dependencies:
- it is hidden in the 'meta' so it adds 'yet another file' to find out
the task flow
- they execute prior to the role with a lot of rules to which
variables and keywords are inherited
- the dependent is also the parent, which many find counterintuitive
- the import always happens, conditionals are appended to the
tasks/handlers on execution
with import/include:
- inheritance is clear, set at the time of import/inclusion (import
directly, include via apply option)
- with include_role you can avoid importing at all, import_role
behaves closer to roles:/dependencies
- finer control on when to execute
- you can dynamically choose the role and/or entry points for the role
(tasks_from/vars_from/etc)
Currently the only advantage of dependency over include/import is that
it is both runtime and install time so you don't need to add the role
to 'requirements' file, which can be dealt with if we automate
requirements file creation (some issues with dynamic role selection,
but should work for static references).
----------
Brian Coca