Courseiva

EX294 Manage task execution and roles Practice Question

Which TWO of the following statements about Ansible roles are correct?

⚠ Common exam trap

The trap is mixing up defaults vs vars precedence and static vs dynamic role inclusion; candidates often assume defaults override inventory variables or that include_role is static, both of which are backwards.

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

✓

Variables in 'defaults/main.yml' have the lowest precedence and can be overridden by inventory variables.

Option B is correct because variables defined in a role's defaults/main.yml have the lowest precedence in Ansible's variable hierarchy, meaning they can be overridden by inventory variables (host_vars, group_vars), play vars, and virtually any other variable source. Option C is correct because role dependencies are declared in the meta/main.yml file under the 'dependencies' key, which Ansible reads to automatically pull in and execute dependent roles before the current role. Option A is incorrect because the 'ansible-role-' prefix is only a naming convention recommended for Galaxy, not a mandatory requirement. Option D is incorrect because include_role performs dynamic inclusion at runtime, whereas import_role is used for static imports. Option E is incorrect because pre_tasks in a playbook always run before the roles section, not after.

Answer analysis

Option-by-option breakdown

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

  • ✗

    Role names must be prefixed with 'ansible-role-' when published to Ansible Galaxy.

    Why it's wrong here

    Ansible Galaxy accepts role names without any mandatory prefix; the ansible-role- convention is optional and only affects repository naming. It is tempting because many published Galaxy roles do use that prefix, making it the correct choice when mirroring GitHub repository names, but Ansible itself imposes no such requirement.

  • ✓

    Variables in 'defaults/main.yml' have the lowest precedence and can be overridden by inventory variables.

    Why this is correct

    Variables in `defaults/main.yml` sit at the bottom of Ansible's precedence order, below inventory group_vars, host_vars and play vars. This satisfies the stem's requirement that role defaults remain overridable, letting consumers customise a role without editing its files.

  • ✓

    Role dependencies are defined in the 'meta/main.yml' file.

    Why this is correct

    Role dependencies belong in `meta/main.yml`, where the `dependencies` list names roles that must run before this role. Ansible resolves these automatically during playbook execution, satisfying the stem's requirement for a correct statement about role structure. This file also holds Galaxy metadata, but dependency resolution is its key runtime function.

  • ✗

    The 'include_role' module can only be used for static imports.

    Why it's wrong here

    include_role performs dynamic inclusion at runtime, whereas import_role handles static parsing; include_role cannot be used for static imports. It is tempting because include_role is the right choice when a role must be conditionally loaded during execution, but static behaviour belongs exclusively to import_role.

  • ✗

    A role's tasks are executed before any 'pre_tasks' defined in the playbook.

    Why it's wrong here

    Ansible executes a play's pre_tasks before it applies any roles, so a role's tasks cannot run ahead of them. It is tempting because roles do run before post_tasks and handlers, making them the right choice for ordering cleanup or notification steps, but pre_tasks always precede role execution.

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 →

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.