Courseiva

EX294 Manage inventories and credentials Practice Question

An administrator maintains a project directory with an inventory file `inventory.ini` that contains a group `db_servers` with hosts `db1.example.com` and `db2.example.com`. The playbook `site.yml` must run only against these two hosts, but the inventory also contains other groups. The administrator wants to avoid modifying the inventory file and instead use a command-line option to limit execution to `db_servers`. Which command should be used?

⚠ Common exam trap

Test-takers frequently confuse host-limiting options with task-limiting or variable-passing options, assuming that any extra flag can restrict execution to a group.

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

✓

ansible-playbook -i inventory.ini site.yml --limit db_servers

The --limit option is the correct way to restrict a playbook run to a subset of hosts defined in the inventory, such as a group. It overrides the play's host pattern without modifying the inventory or playbook. The other options either pass variables, control task execution, or filter tags, none of which select hosts. Thus, only --limit db_servers targets the intended group.

Answer analysis

Option-by-option breakdown

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

  • ✓

    ansible-playbook -i inventory.ini site.yml --limit db_servers

    Why this is correct

    The --limit option restricts execution to the specified subset of hosts. Using the group name db_servers correctly targets only hosts in that group. This is the intended mechanism to override the play's host pattern without editing the inventory. The command assumes the playbook's hosts directive matches a broader pattern, but --limit applies on top. It is the correct approach for the scenario.

  • ✗

    ansible-playbook -i inventory.ini site.yml --start-at-task db_servers

    Why it's wrong here

    --start-at-task begins execution at a specific task name, not a host group. Passing a group name like db_servers would cause an error or skip tasks until a task with that name is found. It does not limit hosts and is completely unrelated to host selection. This option is a misuse of a task-control feature and would not target the desired hosts.

  • ✗

    ansible-playbook -i inventory.ini site.yml -e "target=db_servers"

    Why it's wrong here

    The -e option passes extra variables to the playbook; it does not filter hosts. Unless site.yml explicitly uses the target variable in its hosts line (e.g., hosts: "{{ target }}"), this has no effect on host selection. The scenario states no such variable usage, so this command would likely run against all hosts in the play's pattern, not just db_servers. It fails to achieve the goal.

  • ✗

    ansible-playbook -i inventory.ini site.yml --tags db_servers

    Why it's wrong here

    --tags runs only tasks tagged with the specified value. It does not filter hosts; it filters tasks within the play. Unless tasks are tagged db_servers, nothing would run. Even if tags matched, the play would still execute against all hosts in the pattern, not just the db_servers group. This option confuses tag filtering with host limiting and does not meet the requirement.

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 →

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.