EX294 Manage task execution and roles Practice Question
Which TWO elements can be used to include external task files in a playbook?
⚠ Common exam trap
Watch out — candidates often confuse `include_tasks` and `import_tasks` with variable-loading or inventory-modifying modules, or they mistakenly think `include_role` can be used to include arbitrary task files instead of entire roles.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
import_tasks
Both A. import_tasks and B. include_tasks are the two Ansible directives designed to bring external task files into a playbook, which is exactly what the scenario asks for. import_tasks is processed statically at playbook parse time, so the referenced YAML file's tasks are inserted before execution begins, making it suitable for fixed, always-included task lists. include_tasks is processed dynamically at runtime, allowing the included file to be chosen conditionally or looped over, which is useful when the task file depends on variables or facts. The other options do not belong: include_vars loads variables from an external file rather than tasks, add_host dynamically adds a host to the in-memory inventory, and include_role imports a role (which may contain tasks) but is not the directive for including a standalone external task file.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
import_tasks
Why this is correct
import_tasks is processed statically at playbook parse time, splicing the external task file into the play before execution. This makes it one of the two valid elements for including external task files in a playbook.
- ✓
include_tasks
Why this is correct
`include_tasks` dynamically imports a separate YAML task file at runtime, satisfying the requirement to include external task files in a playbook. Unlike static `import_tasks`, it is processed when execution reaches that point, allowing loops and conditionals to control inclusion. This makes it a valid answer alongside `import_tasks`.
- ✗
include_vars
Why it's wrong here
include_vars loads external variable data into a play, not task files, so it cannot import tasks. It is tempting because it is an include-style module that pulls external content at runtime, and would be correct when you need to read variables from a separate YAML or JSON file.
- ✗
add_host
Why it's wrong here
add_host dynamically adds a host to the in-memory inventory during a play; it cannot pull external task files into a playbook. It is tempting because it does extend a play at runtime, and would be correct when you need to register newly provisioned hosts so subsequent plays target them.
- ✗
include_role
Why it's wrong here
include_role imports a role's tasks, handlers and defaults as a unit; it does not include a standalone external task file. It is tempting because it does pull external task content, and would be correct when reusing a packaged, structured role rather than a loose list of tasks.
Go deeper
Related to this question
About these practice questions
Courseiva writes every EX294 question from scratch — 392 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This EX294 practice question is part of Courseiva's free Red Hat certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the EX294 exam.