Courseiva
Transform data with filters and pluginshardMultiple ChoiceObjective-mapped

EX294 Transform data with filters and plugins Practice Question

A team is migrating from static inventory to dynamic inventory using a custom script. The script returns JSON with a group 'webservers' containing hosts. However, the playbook targeting 'webservers' fails with 'no hosts matched'. Which filter or plugin issue is most likely?

⚠ Common exam trap

Red Hat often tests the misconception that 'no hosts matched' is caused by a missing group or incorrect host targeting, when in reality it is a dynamic inventory protocol compliance issue—specifically the absence of the `_meta` key in the script output.

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

The script output is missing the '_meta' key with 'hostvars'.

Dynamic inventory scripts must include a `_meta` key with `hostvars` in their JSON output for Ansible to properly resolve host variables and match hosts to groups. Without `_meta`, Ansible cannot associate host-specific variables (like `ansible_host`) with the hosts listed under `webservers`, causing the playbook to see no matched hosts even though the group exists.

Answer analysis

Option-by-option breakdown

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

  • The playbook uses 'hosts: all' but should use 'hosts: webservers'.

    Why it's wrong here

    The playbook already targets webservers, so this is not the issue.

  • The script is not executable.

    Why it's wrong here

    If not executable, Ansible would report an error, not 'no hosts matched'.

  • The 'ansible_host' variable is not set in hostvars.

    Why it's wrong here

    Missing ansible_host causes connection issues, but hosts would still be matched.

  • The script output is missing the '_meta' key with 'hostvars'.

    Why this is correct

    Dynamic inventory scripts require _meta structure; without it, Ansible may not recognize hosts.

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

One of 520 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 by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

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.