EX294 Manage task execution and roles Practice Question
A developer wants to reuse a set of tasks that conditionally include other task files based on variables defined per host. Which method should be used to ensure the included tasks are evaluated per host at runtime?
⚠ Common exam trap
Many candidates confuse static imports (import_tasks, import_role) with dynamic includes (include_tasks, include_role), not realizing that static imports are resolved at parse time and cannot handle per-host conditional logic at runtime.
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
✓
include_tasks
Include_tasks, because it dynamically loads and evaluates task files at runtime, allowing conditional logic and per-host variables to be resolved when the tasks are executed. This is essential for reusing a set of tasks that conditionally include other task files based on variables defined per host, as include_tasks processes the included file fresh each time it is encountered, respecting any host-specific variable context.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
include_tasks
Why this is correct
`include_tasks` is processed dynamically at runtime for each host, so conditional expressions and variables are evaluated per host as the play executes. This satisfies the requirement that included task files be selected based on host-specific variables, unlike static `import_tasks`, which resolves everything when the playbook is parsed.
- ✗
include_role
Why it's wrong here
include_role is processed at runtime, but the stem requires conditionally including task files, which include_tasks handles per host. It is tempting because it reuses roles dynamically, and it would be correct when the entire role, rather than individual task files, must be selected per host.
- ✗
import_role
Why it's wrong here
import_role is processed at playbook parse time, so conditional includes inside it are evaluated once rather than per host. It is tempting because it reuses role structure cleanly, and it would be correct when the role's tasks and variables are static across all hosts.
- ✗
import_tasks
Why it's wrong here
import_tasks is processed statically at playbook parse time, so conditional includes are resolved before host variables are known, failing per-host runtime evaluation. It is tempting because it suits static, unconditional task reuse where the same tasks always apply to every host.
Visual reference
Go deeper
Related to this question
About these practice questions
This EX294 question is part of Courseiva's 392-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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.