Courseiva

EX294 Manage task execution and roles Practice Question

An administrator has a role named 'web' that must run a package installation task before any other tasks in the role. The role contains a tasks/main.yml file and a meta/main.yml file. The administrator wants the package installation to be a separate role named 'common' that is always executed first when the 'web' role is applied. Which approach should the administrator use?

⚠ Common exam trap

The trap here is assuming that listing roles in a play is equivalent to defining a dependency, but a play-level list only orders roles for that specific play and does not enforce the dependency for other playbooks.

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

✓

Add a dependencies section to meta/main.yml in the 'web' role listing the 'common' role.

Role dependencies declared in meta/main.yml cause the dependent role to execute before the current role. This ensures the 'common' role's package installation runs first whenever 'web' is applied, regardless of the playbook. It is the intended way to express that one role requires another, keeping the relationship self-contained within the role.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    Add the 'common' role to the roles list in the play before the 'web' role.

    Why it's wrong here

    Listing roles in a play does control order, but the requirement is to ensure the dependency whenever the 'web' role is used, not just in one play. If another playbook uses the 'web' role without explicitly listing 'common', the package installation would be skipped. Role dependencies in meta/main.yml make the relationship intrinsic to the role.

  • ✓

    Add a dependencies section to meta/main.yml in the 'web' role listing the 'common' role.

    Why this is correct

    Role dependencies defined in meta/main.yml cause the listed roles to execute before the current role. This ensures the 'common' role runs first, installing packages before any 'web' tasks. Dependencies are resolved at playbook parse time and are the standard mechanism for ordering role execution without modifying the play itself.

  • ✗

    Use include_role with a when condition in tasks/main.yml of the 'web' role.

    Why it's wrong here

    include_role executes dynamically at runtime and would run after any tasks preceding it in tasks/main.yml. It does not guarantee execution before all other tasks unless placed first, and a when condition adds unnecessary complexity. Dependencies in meta/main.yml are specifically designed for pre-requisite roles and are evaluated before the role's tasks.

  • ✗

    Use import_tasks in tasks/main.yml to import a tasks file from the 'common' role.

    Why it's wrong here

    import_tasks imports task files, not roles. It cannot import an entire role's tasks, handlers, and defaults. While you could manually replicate tasks, this bypasses role encapsulation and does not satisfy the requirement of reusing the 'common' role as a dependency. The correct mechanism is role dependencies in meta/main.yml.

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 →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Red Hat exam blueprint

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.