Courseiva

EX294 Manage inventories and credentials Practice Question

An administrator is using ansible-playbook with an inventory file that defines a group 'webservers' and a group 'dbservers'. The administrator wants to run a playbook only against hosts in 'webservers' but exclude any host that is also in 'dbservers'. Which inventory pattern should be used with the --limit option?

⚠ Common exam trap

The trap here is using a comma instead of a colon to separate the group and the exclusion pattern, which is invalid syntax and will not work as intended.

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

✓

webservers:!dbservers

Ansible inventory patterns support set operations using colons and special characters. To select hosts in one group and exclude those in another, the pattern 'group1:!group2' is used. The exclamation mark indicates exclusion, and the colon separates the two patterns. This allows precise targeting of hosts for playbook execution.

Answer analysis

Option-by-option breakdown

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

  • ✗

    webservers:&dbservers

    Why it's wrong here

    The pattern 'webservers:&dbservers' selects the intersection of hosts that are in both webservers and dbservers. This would run only on hosts that belong to both groups, which is not the requirement. The ampersand denotes intersection, not exclusion.

  • ✗

    webservers:dbservers

    Why it's wrong here

    The pattern 'webservers:dbservers' selects the union of hosts in webservers and dbservers, meaning all hosts from both groups. This is the opposite of what the administrator wants, as it would include hosts that are in dbservers. The colon without exclamation is used for union, not exclusion.

  • ✓

    webservers:!dbservers

    Why this is correct

    The pattern 'webservers:!dbservers' selects all hosts in webservers and then excludes any host that is in dbservers. This is the correct syntax for set operations in Ansible inventory patterns. The colon separates the intersection and exclusion, and the exclamation mark denotes exclusion. This pattern will limit execution to the desired hosts.

  • ✗

    webservers,!dbservers

    Why it's wrong here

    The comma in the pattern 'webservers,!dbservers' is not valid syntax for exclusion in Ansible inventory patterns. Ansible uses colons to separate patterns and exclamation marks for exclusion. Using a comma may result in a parsing error or unexpected behavior. The correct syntax requires a colon before the exclamation mark.

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.