Courseiva

EX294 Manage inventories and credentials Practice Question

An administrator uses an inventory file with a group 'web' and a host 'web1' that also belongs to group 'db'. The group_vars/web.yml file sets 'http_port: 80', and group_vars/db.yml sets 'http_port: 3306'. The playbook uses 'http_port' to configure a service. What will be the value of http_port for web1 when the playbook runs?

⚠ Common exam trap

The trap here is thinking that inventory file order or a failure occurs when a variable is defined in multiple groups, when actually alphabetical group order determines the final value.

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

✓

80, because group_vars/web.yml takes precedence over group_vars/db.yml for hosts in both groups.

When a host belongs to multiple groups, Ansible merges group variables by processing groups in alphabetical order. Later groups override earlier ones. 'db' precedes 'web' alphabetically, so variables from group_vars/web.yml override those from group_vars/db.yml. Thus http_port becomes 80. Inventory file order and duplicate definitions do not cause errors; precedence rules apply.

Answer analysis

Option-by-option breakdown

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

  • ✗

    3306, because the 'db' group is alphabetically before 'web'.

    Why it's wrong here

    The alphabetical order of group names affects merging, with later groups overriding earlier ones. 'db' comes before 'web', so variables from 'web' would override those from 'db'. Therefore, http_port would be 80, not 3306. This option incorrectly assumes that the earlier group wins, which is the opposite of Ansible's behavior.

  • ✗

    The playbook will fail with an error because http_port is defined in two groups.

    Why it's wrong here

    Ansible does not error when a variable is defined in multiple groups; it merges them using precedence rules. Duplicate variable definitions are common and resolved silently. The playbook will run with the value determined by group precedence. This option incorrectly assumes that conflicting group variables cause a failure.

  • ✓

    80, because group_vars/web.yml takes precedence over group_vars/db.yml for hosts in both groups.

    Why this is correct

    Ansible merges group variables for a host by processing groups in alphabetical order, with later groups overriding earlier ones. Since 'web' comes after 'db' alphabetically, variables from group_vars/web.yml override those from group_vars/db.yml. Therefore, http_port is 80 for web1. This is the correct precedence rule for group variables at the same level.

  • ✗

    80, because the 'web' group appears first in the inventory file.

    Why it's wrong here

    Group order in the inventory file does not determine variable precedence. Ansible merges group variables based on alphabetical order of group names, not inventory order. The 'db' group comes before 'web' alphabetically, so 'db' variables would be overridden by 'web' variables if both applied, but in this case 'web' is later alphabetically and would win if both were at the same level.

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.