Courseiva

EX294 Manage inventories and credentials Practice Question

A playbook must run only against hosts that belong to both the `webservers` group and the `production` group. Your inventory defines these as separate groups, and a host named web3 is a member of both. Which inventory pattern restricts the play's hosts to exactly that intersection?

⚠ Common exam trap

The trap here is reading the colon as an intersection when it actually forms a union, and confusing the ampersand intersection operator with exclusion.

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

✓

hosts: webservers:&production

Ansible group patterns use colon-prefixed operators: a leading ampersand means intersection, a leading exclamation mark means exclusion, and a bare colon means union. Placing an ampersand before the second group limits the selection to hosts that are members of both groups, which matches the requirement that only hosts in webservers and production be targeted by the play.

Answer analysis

Option-by-option breakdown

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

  • ✗

    hosts: webservers:production

    Why it's wrong here

    The colon character creates a union of groups, so this pattern targets every host in webservers plus every host in production. Hosts that belong to only one of the groups would also be included, which violates the requirement to run solely on the intersection. Intersection requires a different separator in the pattern syntax.

  • ✗

    hosts: webservers[production]

    Why it's wrong here

    Bracket notation is not valid group pattern syntax in Ansible. Square brackets appear in host range patterns such as web[1:5], where they expand numbered hostnames, not in group expressions. Using them here would produce a pattern that matches no groups and likely a warning about an empty host list rather than the intended intersection.

  • ✓

    hosts: webservers:&production

    Why this is correct

    The ampersand prefix introduces an intersection constraint, so the pattern selects only hosts that are members of webservers and also members of production. Because web3 belongs to both groups, it is included, while hosts in just one group are excluded. This is the documented syntax for intersecting group membership in a play's hosts line.

  • ✗

    hosts: webservers:!production

    Why it's wrong here

    The exclamation mark excludes hosts, so this pattern targets members of webservers that are not in production. That is the exact opposite of the requirement, since it deliberately removes the production hosts the play must address. Exclusion syntax is useful for skipping groups but cannot express an intersection.

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.