In some of my roles I would like to use different entry points (not the usual main.yaml under tasks, but other.yaml).
The relatively new Role argument validation (see the start of the specs) has primary support for entry points.
For include_role / import_role this is well supported using the tasks_from keyword.
But for the “old” roles: part in a play, it doesn’t seem to be supported. At least, according to this stackoverflow post:
Why is it not supported for the roles: part?
Am I just missing the proper documentation on how to call it with an entry point? Then maybe someone please go ahead and post a new answer on that stackoverflow posting. Please.
Is this considered so advanced, that you’re anyway expected to use include_role / import_role?
I don’t know if there is official documentation concerning this, but when I started using Ansible several years ago, multiple people on IRC told me not to use the roles: , as it was the “old” way to do it and would be deprecated…instead to use include_role / import_role, which were far more advanced and the future standard.
So I have never used roles: myself, and don’t believe there is any benefit to it…
Don’t believe random people on the internet (including me). While i WISH this were true, roles: is not deprecated and is not going anywhere, but it is also not going to get new features as the way it works is very different from what we can do with include_role/import_role.
Ehh, I guess it’s a matter of taste. I would rather have it be “verbose” myself - easier to remember things months/years later when you/others are reviewing code
Good note, thanks. I find include/import role to work great for what I need.