Courseiva

EX294 Manage inventories and credentials Practice Question

Your team stores two inventories: a static file at inventories/prod and a dynamic inventory plugin configuration at inventories/aws_ec2.yml. The static file defines the group `db` with `db1 ansible_host=172.16.5.10`, while the plugin also returns a host named db1 with the address 172.16.5.99. You run `ansible-inventory -i inventories/prod -i inventories/aws_ec2.yml --host db1`. Which host variable value does Ansible report for ansible_host?

⚠ Common exam trap

The trap here is assuming command-line order of -i flags decides precedence, when merging actually favors the last-processed source.

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

✓

172.16.5.99, because the last inventory source processed takes precedence for the same host.

Merging multiple inventories unifies hosts and groups rather than rejecting duplicates. For a host present in several sources, variables from the source processed later override those from earlier sources. Since the dynamic plugin is processed after the static file, its ansible_host value is the one that survives, so the host resolves to the plugin-provided address.

Answer analysis

Option-by-option breakdown

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

  • ✓

    172.16.5.99, because the last inventory source processed takes precedence for the same host.

    Why this is correct

    When inventories are merged, Ansible combines hosts and groups, and for a host defined in more than one source the variable values from the later source override earlier ones. Here the dynamic plugin is processed after the static file, so its ansible_host value of 172.16.5.99 prevails. You can verify this with ansible-inventory before running production playbooks.

  • ✗

    Both values are retained, and Ansible fails with a duplicate host variable error.

    Why it's wrong here

    Ansible does not raise an error for a host appearing in multiple inventories; it merges the definitions and applies a precedence rule to conflicting variables. The inventory system is deliberately tolerant of overlapping sources so that dynamic and static data can be combined. A duplicate-variable failure would make hybrid inventories unusable.

  • ✗

    Neither value; Ansible reports the host as undefined because duplicate host names are skipped.

    Why it's wrong here

    Duplicate host names are not discarded. Ansible treats the host as a single entity and merges the variables from each source, so db1 remains addressable and pingable. The command returns a definition for db1 rather than an empty result, which is why precedence rules for conflicting variables exist in the first place.

  • ✗

    172.16.5.10, because the first inventory source listed on the command line takes precedence.

    Why it's wrong here

    Ansible does not resolve conflicts by the order of -i flags. When the same host is defined in multiple sources, the last source processed wins for overlapping variables, so the first-listed static file does not override the plugin. Assuming leftmost precedence leads to the wrong address being used in playbooks.

Visual reference

Client Recursive Resolver Root DNS (13 root servers) TLD DNS (.com, .org, …) Authoritative example.com query IP addr answer

About these practice questions

This EX294 question is part of Courseiva's 392-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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.