In my experience, I've really only used `import_role` as a task-level declaration, Occasionally after some preliminary setup tasks.
The `roles` declaration at the top of the playbook will always execute before the set of tasks in a given playbook. It's possible there are other, potentially larger, facets that I'm missing but for the most part the only *significant* distinctions I've been able to make between the two of them is ordering, specifically that: - roles declared in the roles heading will be executed before all tasks in a playbook - tasks that use the import_role module(?) are able to be arranged wherever the playbook writer chooses in the task list, giving a lot more flexibility on the side of playbook designers. Hope this helps! On Fri, Oct 5, 2018 at 4:30 PM Dmitry Makovey <[email protected]> wrote: > Hi, I would like to clarify things relating to new "import_role" statement > - documentation mentions it as a "new syntax" however it does not mention > about the plans for the "roles" syntax. What's the plan moving forward. I > see both statements as distinct entities, however some of my colleagues > seem to be confused about the state of affairs so we'd like some > clarification on the matter. > > So, to re-phrase my question differently: > > is there a merit in abandoning "roles:" statement from our playbooks > moving forward in favor of "import_role" to future-proof our code? > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/e17de5ec-7f17-4933-9615-b8c169bd6645%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/e17de5ec-7f17-4933-9615-b8c169bd6645%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAD0resK7P6G39Pw_Gr-cL0dGi6DHmGeixtLBbHuEeU6gUWcMmw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
