EX294 Manage task execution and roles Practice Question
An Ansible role has a complex dependency tree. The administrator wants to ensure that dependencies are installed before the main role tasks. Which file should be used to define dependencies?
⚠ Common exam trap
Candidates often confuse `meta/main.yml` with `tasks/main.yml` or `vars/main.yml`, mistakenly thinking dependencies can be defined in the same file as tasks or variables, when in fact only `meta/main.yml` supports the `dependencies` directive.
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
✓
meta/main.yml
In Ansible, role dependencies are defined in the `meta/main.yml` file using the `dependencies` key. This ensures that any listed roles are executed before the main role's tasks, providing a controlled execution order. The `meta/main.yml` file is specifically designed for metadata such as dependencies, author information, and supported platforms.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
meta/main.yml
Why this is correct
Dependencies declared in meta/main.yml are processed by Ansible before the role's tasks execute, guaranteeing prerequisite roles run first. This satisfies the constraint of ensuring dependencies install ahead of the main role in a complex dependency tree.
- ✗
defaults/main.yml
Why it's wrong here
Role dependencies belong in meta/main.yml, which Ansible reads before executing the role's tasks; defaults/main.yml only supplies low-precedence variable values to the role. It is tempting because defaults are loaded early, but they carry no dependency-execution semantics, so listing roles there installs nothing.
- ✗
tasks/main.yml
Why it's wrong here
Dependencies must be declared in meta/main.yml, which Ansible reads before running the role; tasks/main.yml holds the role's own task list. It is tempting because tasks execute in sequence, but placing role references there runs them inline rather than as prerequisites, breaking the dependency tree.
- ✗
vars/main.yml
Why it's wrong here
Dependencies are declared in meta/main.yml, which Ansible parses to build the role execution order; vars/main.yml merely defines high-precedence variables. It tempts administrators because vars files are loaded before tasks run, yet they cannot register roles for installation, so no dependency executes.
Go deeper
Related to this question
About these practice questions
One of 392 original EX294 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.