Much like the roles: keyword, this task loads a role, but it allows you to control it when the role tasks run in between other tasks of the play.

Most keywords, loops and conditionals will only be applied to the imported tasks, not to this statement itself. If you want the opposite behavior, use include_role instead. To better understand the difference you can read the Including and Importing Guide.

-hosts:alltasks:-import_role:name:myrole-name:Run tasks/other.yaml instead of 'main'import_role:name:myroletasks_from:other-name:Pass variables to roleimport_role:name:myrolevars:rolevar1:value from task-name:Apply condition to each task in roleimport_role:name:myrolewhen:not idontwanttorun