EX294 Manage task execution and roles Practice Question
Exhibit
- hosts: all
tasks:
- name: Import tasks
import_tasks: "{{ item }}.yml"
loop:
- setup
- configureRefer to the exhibit. The playbook fails with an error. What is the most likely cause?
⚠ Common exam trap
Red Hat often tests the distinction between static (`import_tasks`) and dynamic (`include_tasks`) includes, and the trap here is that candidates confuse the two, thinking any include can be used with a loop, when only dynamic includes support iteration.
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 cannot be used with a loop.
`import_tasks` is a static import that is processed at playbook parse time, before any variables or loops are evaluated. Ansible does not support using `import_tasks` inside a loop (`loop:` or `with_items:`) because the import occurs once during parsing, not dynamically per iteration. To run tasks repeatedly, you must use `include_tasks`, which is processed dynamically at runtime and supports loops.
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 cannot be used with a loop.
Why this is correct
The failure stems from `import_tasks` being static: it is parsed at playbook load time, so it cannot accept a `loop`, which is evaluated at runtime. The stem's error arises because the task file is imported before loop items exist. Switching to `include_tasks`, which is dynamic, resolves this constraint.
- ✗
import_tasks must be placed in a role.
Why it's wrong here
import_tasks works in any playbook, not only inside roles, so this restriction does not exist and cannot cause the failure. It is tempting because import_tasks is frequently seen within roles, but the real error stems from something else in the exhibit, such as a syntax or module issue.
- ✗
The loop variable should be referenced as '{{ item }}' without quotes.
Why it's wrong here
Quoting '{{ item }}' still resolves the variable; Ansible strips the quotes during templating, so this is not the failure. It is tempting because quoting Jinja expressions looks suspicious, but the actual error lies elsewhere, such as a malformed module argument or indentation.
- ✗
The file names must be literal without templates.
Why it's wrong here
Templated file names are permitted in copy and template modules, so literal names are not required and this cannot trigger the error. It is tempting because templating filenames can confuse debugging, but the actual failure comes from another cause visible in the exhibit.
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.