Courseiva

EX294 · topic practice

Transform data with filters and plugins practice questions

This domain covers Ansible data transformation using Jinja2 filters, lookups, and plugin collections. You must select, map, and reshape structured data from variables, JSON API responses, and fact dictionaries inside playbooks. Questions test filter syntax, lookup plugin usage, and correct handling of lists of dictionaries within tasks and templates.

Courseiva uses original exam-style practice questions designed for learning and revision. The goal is to understand the concepts, recognise exam patterns, and improve through explanations — not memorise copied exam dumps.

Editorial oversight:Johnson Ajibi· MSc IT Security, IEEE Senior Member
20 questionsDomain: Transform data with filters and plugins

What the exam tests

What to know about Transform data with filters and plugins

Be able to chain Jinja2 filters such as selectattr, map, and list to extract values from lists of dictionaries, and use lookup plugins correctly. The most important thing is verifying filter order and data type, since a wrong sequence silently returns the wrong structure.

Applying Jinja2 filters like selectattr, map, and json_query to lists of dictionaries

Using lookup plugins such as community.general.dig to resolve host addresses dynamically

Transforming API JSON responses into filtered lists for downstream task consumption

Referencing nested dictionary keys and list elements correctly in Ansible templates

Watch out for

Common Transform data with filters and plugins exam traps

  • ▸Confusing selectattr with map, or chaining them in the wrong order, which returns dictionaries instead of the intended scalar values.
  • ▸Forgetting that lookup plugins run on the control node, not the managed host, so host-specific facts are unavailable.
  • ▸Treating a JSON string as already-parsed data; you must use from_json before applying filters or indexing keys.

Practice set

Transform data with filters and plugins questions

20 questions · select your answer, then reveal the explanation

Question 1easymultiple choice
Read the full Ansible explanation →

An Ansible playbook needs to extract the first line from a multi-line string variable 'output' and store it in a new variable 'first_line'. Which filter should be used?

Question 2mediummultiple choice
Read the full Ansible explanation →

A playbook uses the 'uri' module to query an API and registers the result. The API returns a JSON with a nested field 'data.users[0].name'. Which expression correctly extracts that name?

Question 3hardmultiple choice
Read the full Ansible explanation →

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?

Question 4mediummultiple choice
Read the full Ansible explanation →

A playbook uses the 'debug' module to print a variable 'myvar' which is a list of dictionaries. The output shows 'VARIABLE IS UNDEFINED' despite the variable being defined earlier. Which filter issue is most likely?

Question 5mediummulti select
Read the full Ansible explanation →

Which TWO filters are used to transform data types in Ansible?

Question 6hardmulti select
Read the full Ansible explanation →

Which THREE plugins are used for data transformation in Ansible?

The debug output shows 'changed' even when the firewall rule already existed. Which filter issue could cause this?

Exhibit

Refer to the exhibit.

- name: Configure firewall
  hosts: all
  tasks:
    - name: Allow HTTP
      ansible.posix.firewalld:
        service: http
        permanent: yes
        state: enabled
      register: fw_result

    - debug:
        msg: "{{ 'changed' if fw_result.changed else 'no change' }}"
Question 8hardmultiple choice
Read the full Ansible explanation →

Your organization manages a fleet of 500 web servers running RHEL 8. Each server has a custom fact file /etc/ansible/facts.d/web.fact containing:

[web]

docroot=/var/www/html port=80 admin=admin@example.com

You have a playbook that needs to configure the firewall to allow traffic on the port defined in the custom fact for each server. The playbook uses the 'ansible_local' variable to access these facts. However, some servers have the custom fact file missing or malformed. The task to open the firewall port fails on those servers with 'VARIABLE IS UNDEFINED'. You need to implement a solution that handles missing custom facts gracefully, setting a default port of 8080 if the fact is not defined, and still log a warning. Which approach should you take?

Question 9easymultiple choice
Read the full Ansible explanation →

An Ansible playbook needs to generate a list of IP addresses from a range 192.168.1.10 to 192.168.1.20. Which filter should be used in a Jinja2 template?

Question 10hardmulti select
Read the full Ansible explanation →

An Ansible playbook retrieves a list of dictionaries from an API. Each dictionary has keys 'name', 'status', and 'zone'. The playbook needs to filter out entries where 'status' is 'inactive' and then extract only the 'name' values. Which THREE of the following combinations of filters and loops would achieve this?

Question 11hardmultiple choice
Read the full Ansible explanation →

You are maintaining an Ansible automation for a large Red Hat Enterprise Linux deployment. The playbook configures NTP servers on all managed nodes. It uses a variable 'ntp_servers' defined in group_vars/all.yml as a list: ['0.rhel.pool.ntp.org', '1.rhel.pool.ntp.org', '2.rhel.pool.ntp.org']. The playbook task uses the 'uri' module to test connectivity to each server, but only if the server is reachable. The task currently uses:

``` - name: Test NTP server reachability uri: url: "http://{{ item }}:123" timeout: 5 register: result loop: "{{ ntp_servers }}" until: result.status == 200 retries: 3 delay: 2 ```

However, the playbook fails because the NTP servers do not respond to HTTP on port 123. You need to change the approach to test ICMP reachability using the 'ping' module, but the 'ping' module does not support a custom destination port. You also want to continue using a loop and register the success/failure per server. Which of the following is the best course of action?

Question 12hardmulti select
Read the full Ansible explanation →

When using the 'uri' module to interact with a REST API in Ansible, which TWO of the following statements about error handling and response parsing are correct?

Question 13easymultiple choice
Read the full Ansible explanation →

Refer to the exhibit. After running the playbook, the 'content' field contains an HTML page. The team wants to extract the text inside the <h1> tags using Ansible filters. Which of the following tasks correctly extracts the content of the <h1> element?

Exhibit

Refer to the exhibit.

```
- name: Check Apache status
  hosts: webservers
  tasks:
    - name: Get URL content
      uri:
        url: http://localhost/server-status
        return_content: yes
      register: result

    - name: Debug output
      debug:
        var: result
```

Output:
```
ok: [web01] => {
    "result": {
        "changed": false,
        "content": "<html><body><h1>Apache Status</h1>...</body></html>",
        "status": 200,
        "url": "http://localhost/server-status"
    }
}
```
Question 14mediummultiple choice
Read the full Ansible explanation →

You are managing a fleet of 200 RHEL 8 servers with Ansible Tower. A playbook uses the 'seboolean' module to enable httpd_can_network_connect for a web application. Recently, the playbook has been failing on 10 servers with the error: 'Failed to set SELinux boolean: Unable to communicate with SELinux policy'. Other servers succeed. The playbook runs as the 'ansible' user with passwordless sudo. The failing servers have identical SELinux configuration (enforcing mode, targeted policy) and the same package versions as working servers. You suspect the issue is related to the 'python3-libselinux' package. Which of the following is the most likely cause and the correct fix?

Match each SELinux context component to its meaning.

Drag a concept onto its matching description — or click a concept then click the description.

Concepts
Matches

SELinux user identity

Role-based access control

Type enforcement (most common)

MLS sensitivity level

MLS/MCS category range

Which filter converts a string like 'hello' into a list of characters ['h','e','l','l','o']?

Question 17easymultiple choice
Read the full Ansible explanation →

What does the `| quote` filter do in an Ansible task?

Which lookup plugin is used to retrieve values from an AWS SSM Parameter Store?

Question 19hardmultiple choice
Read the full Ansible explanation →

You run a playbook with `msg: "{{ 'mypassword' | password_hash('sha512') }}"`. What is the output?

You have two dictionaries: `dict1: {a: 1, b: 2}` and `dict2: {b: 3, c: 4}`. You want a new dict that combines both, with `dict2` values taking precedence for overlapping keys. Which filter chain achieves this?

Free account

Track your progress over time

Create a free account to save your results and see which topics improve across sessions.

Focused Transform data with filters and plugins sessions

Start a Transform data with filters and plugins only practice session

Every question in these sessions is drawn from the Transform data with filters and plugins domain — nothing else.

Related practice questions

Related EX294 topic practice pages

Move into related areas when this topic feels solid.

Frequently asked questions

What does the EX294 exam test about Transform data with filters and plugins?
Be able to chain Jinja2 filters such as selectattr, map, and list to extract values from lists of dictionaries, and use lookup plugins correctly. The most important thing is verifying filter order and data type, since a wrong sequence silently returns the wrong structure.
How should I use these practice questions?
Select your answer before revealing the explanation. Then read why each option is right or wrong — this active recall approach builds retention far faster than re-reading notes.
Can I practise just Transform data with filters and plugins questions in a focused session?
Yes — the session launcher on this page draws every question from the Transform data with filters and plugins domain. Use a 10-question session first to gauge your baseline, then move to 20 or 30 once the weak spots are clear.
Where can I practise other EX294 topics?
Use the topic links above to move to related areas, or go back to the EX294 question bank to see all topics.
Are these real exam questions or dumps?
These are original practice questions written to test the same concepts the EX294 exam covers. They are not copied from any real exam or dump site.