EX294 Manage inventories and credentials Practice Question
An administrator is running `ansible-playbook -i inventories/prod site.yml` against the `prod` inventory, which contains a group `web` and a group `db`. The play is defined with `hosts: web:&db`. Which hosts will the play target?
⚠ Common exam trap
It's easy for candidates to confuse the colon union operator with the ampersand intersection operator, which leads to selecting every host in either group instead of the shared members.
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
✓
All hosts that are in both the `web` group and the `db` group
The `:&` syntax in a host pattern performs set intersection, so the play runs only against hosts that are members of both the `web` and `db` groups. The `:` alone would create a union, and a leading `!` would exclude. Because the play uses `web:&db`, the correct target set is the overlap of the two groups.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
All hosts that are in both the `web` group and the `db` group
Why this is correct
In an Ansible host pattern, the `&` separator means intersection (logical AND). Writing `web:&db` selects only hosts that appear in the `web` group and also in the `db` group. This is the correct behavior: the pattern applies both group filters and targets the overlap, which is exactly what the play declares.
- ✗
All hosts in the inventory except those in the `web` and `db` groups
Why it's wrong here
Exclusion in Ansible host patterns is expressed with a leading `!` or `&!`, not with `:&`. The `&` by itself performs intersection, not negation. This option describes an inverted selection, which would require a pattern such as `all:!web:!db`. As written, `web:&db` includes hosts, not excludes them.
- ✗
Only the first host listed in the `web` group that also appears in `db`
Why it's wrong here
Ansible host patterns select all matching hosts, not just the first match. There is no implicit single-host behavior when using `:&`; the play will run against every host in the intersection. This option invents a first-match rule that does not exist in Ansible inventory pattern handling.
- ✗
All hosts that are in the `web` group or in the `db` group
Why it's wrong here
The `:` separator in a host pattern defines a union, so this pattern would target every host belonging to either group. The colon is not the intersection operator; it combines sets. Because the stem uses `:&`, the intended behavior is to intersect the two groups, not to merge them, so this option misreads the pattern syntax.
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 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.