Courseiva

EX294 Transform data with filters and plugins Practice Question

Exhibit

Refer to the exhibit.
```yaml
- name: Get interface IP
  hosts: localhost
  vars:
    interfaces:
      - name: eth0
        ip: 192.168.1.10
      - name: eth1
        ip: 10.0.0.5
  tasks:
    - name: Show IP of eth0
      debug:
        msg: "{{ interfaces | selectattr('name', 'equalto', 'eth0') | map(attribute='ip') | first }}"

Refer to the exhibit. What is the output of the debug task?

⚠ Common exam trap

Many exam-takers confuse `ansible_default_ipv4` with `ansible_all_ipv4_addresses` or think the output includes the interface name, leading them to select the interface name (eth0) or a list of all IPs instead of the single default IP.

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

✓

192.168.1.10

The `debug` task in Ansible uses the `msg` parameter to display the value of a variable. In the exhibit, the variable `ansible_default_ipv4.address` is referenced, which returns the IPv4 address of the default network interface. Since the host's default interface is eth0 with IP 192.168.1.10, the debug output is that IP address. Option D correctly shows the output as '192.168.1.10'.

Answer analysis

Option-by-option breakdown

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

  • ✗

    10.0.0.5

    Why it's wrong here

    The debug task prints whatever the registered variable holds at runtime, not a hard-coded literal; 10.0.0.5 would only appear if the play had set that exact value from gathered facts or inventory. This address is tempting because it looks like a typical host IP, which is what the task actually returns when the variable resolves to an inventory host address.

  • ✗

    [ '192.168.1.10' ]

    Why it's wrong here

    The debug task returns the value of a variable, and a list containing one IP address would only appear if the variable itself held a list. It is tempting because registered variables often store lists of host addresses, which is correct when the task loops over multiple hosts rather than a single interface.

  • ✗

    eth0

    Why it's wrong here

    A bare interface name such as eth0 is a string, not the address the task resolves, so the debug output would not match. It is tempting because interface facts commonly feed network configuration, which is correct when gathering adapter names rather than querying an address value.

  • ✓

    192.168.1.10

    Why this is correct

    The debug task prints the value held in the variable, which resolves to 192.168.1.10 as shown in the exhibit's host facts. Other addresses appearing in the inventory belong to different hosts or interfaces, so they are not the registered output.

About these practice questions

This EX294 question is part of Courseiva's 392-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. 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.