I have found this old thread that also suggests this: "import_role" vs "roles"
IMHO it would really be helpful, if there was some more information on possible deprecation plans.
Benefit… depends on the view. If you have a few simple roles, then
roles:
- role1
- role2
- role3
is quite concise. Doing the same in the new syntax is something like this:
tasks:
- ansible.builtin.import_role:
name: role1
- ansible.builtin.import_role:
name: role2
which feels quite verbose.
Yes, you could use include_role
and loop:
. But include_role
has different semantics than import_role
(which is closer to roles:
).