Imports: static reuse
Importing roles, tasks, or playbooks adds them to a playbook statically. Ansible pre-processes imported files and roles before it runs any tasks in a playbook, so imported content is never affected by other tasks within the top-level playbook.
The file names for imported roles and tasks support templating, but the variables must be available when Ansible is pre-processing the imports. This can be done with thevarskeyword or by using--extra-vars.
You can pass variables to imports. You must pass variables if you want to run an imported file more than once in a playbook. For example:
SeeVariable precedence: where should I put a variable?for more details on variable inheritance and precedence.