EX294 Implement advanced Ansible automation Practice Question
An Ansible playbook uses a custom filter plugin located in the `filter_plugins/` directory next to the playbook. The filter is not being applied, and the playbook fails with an error that the filter is undefined. What is the most likely reason?
⚠ Common exam trap
The trap here is assuming that placing the plugin in the correct directory is enough, when the internal class and method structure is critical for registration.
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 filter plugin file must define a `FilterModule` class with a `filters` method.
Filter plugins require a specific structure: a `FilterModule` class with a `filters` method that returns a dictionary mapping filter names to functions. Without this, Ansible cannot register the filter, leading to an undefined filter error. The directory location and file extension are correct, so the structure is the likely culprit.
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 filter plugin must be written in Python and have a `.py` extension.
Why it's wrong here
Filter plugins are indeed Python files with a `.py` extension, but that alone does not guarantee they are loaded. The issue is more likely related to the directory not being in the search path or the plugin not being structured correctly. The extension is necessary but not sufficient.
- ✗
The `filter_plugins` directory must be specified in `ansible.cfg` using `filter_plugins = ./filter_plugins`.
Why it's wrong here
Ansible automatically searches for a `filter_plugins` directory adjacent to the playbook. Explicit configuration is not required for this default behavior. The failure is likely due to a different cause, such as incorrect plugin structure or missing class definition.
- ✓
The filter plugin file must define a `FilterModule` class with a `filters` method.
Why this is correct
Ansible filter plugins must define a class named `FilterModule` that contains a `filters` method returning a dictionary of filter names to callables. If this structure is missing, the filter will not be registered and will appear undefined. This is the most common reason for such errors.
- ✗
The filter plugin must be placed in a `library` directory instead of `filter_plugins`.
Why it's wrong here
Filter plugins belong in `filter_plugins` directories, not `library`, which is for modules. Placing it in `library` would not make it available as a filter. The directory is correct; the issue is with the plugin's internal structure.
Go deeper
Related to this question
About these practice questions
Courseiva writes every EX294 question from scratch — 392 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. 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.