Question 513 of 520
Ansible Lookup Plugins: Execution and Usage
An Ansible playbook uses the "community.general" collection to manage firewall rules. The engineer wants to use a lookup plugin to fetch the current IPv4 address of a host to include in a dynamic inventory script. Which TWO of the following options correctly describe the usage of lookup plugins in Ansible?
Quick Answer
The key fact this question is testing is where a lookup plugin actually executes - it runs locally on the control node, never on the remote managed hosts, which is why it is the right tool for pulling in external data like an environment variable, a file, or in this case something used to build a dynamic inventory script. Because lookup plugins run independently of any connection to the target host, they can be used anywhere Jinja2 templating is evaluated on the controller, including the vars section of a playbook, which is exactly what the correct answer describes with an example like myvar set from lookup('env','HOME'). This is a useful distinction to hold onto against modules, which typically execute on the remote host to change its state - lookups gather or compute information for the control node's own use, they do not act on the managed nodes. Any exam question that describes needing to pull in data from outside the managed hosts, such as an external file, a database, or an environment variable on the machine running Ansible, and asks how to get that value into a playbook or inventory, is pointing you toward a lookup plugin rather than a module or a filter.
⚠ Common exam trap
Test-takers frequently confuse lookup plugins (control node execution) with modules (remote host execution), or mistakenly think the 'lookup' keyword is a special Ansible keyword rather than a Jinja2 function, leading them to select options A or B.
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
✓
Lookup plugins are executed on the control node and return data to the Ansible controller.
Lookup plugins in Ansible are designed to run on the control node (the machine where Ansible is executed), not on the remote host. They fetch data from external sources (e.g., files, databases, environment variables) and return that data to the Ansible controller for use in playbooks or inventory scripts. This aligns with the requirement to fetch the current IPv4 address of a host for a dynamic inventory script, as the lookup plugin can query local or network sources without needing to execute on the target host.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Lookup plugins are always executed on the remote host.
Why it's wrong here
Lookup plugins run on the control node.
- ✗
Lookup plugins must be imported using the "lookup" keyword.
Why it's wrong here
They are invoked via the lookup function, not imported.
- ✓
Lookup plugins are executed on the control node and return data to the Ansible controller.
Why this is correct
Correct; they fetch data on the control node.
- ✗
The "file" lookup plugin reads the content of a file from the remote host.
Why it's wrong here
The file lookup reads from the control node.
- ✓
Lookup plugins can be used in "vars" sections of a playbook.
Why this is correct
Yes, e.g., vars: myvar: "{{ lookup('env','HOME') }}".
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Same concept, more angles
1 more way this is tested on EX294
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. A senior engineer needs to debug an Ansible playbook that uses lookups. Which TWO plugins can be used to retrieve data from a file on the control node? (Select exactly two.)
hard- A.ini
- B.password
- C.csvfile
- ✓ D.file
- ✓ E.template
Why D: The `file` lookup plugin reads the content of a file from the control node's filesystem and returns it as a string. This is the standard way to retrieve file data directly from the Ansible control node without transferring the file to the managed host.
Last reviewed: Jun 25, 2026
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.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.