Courseiva

EX294 Transform data with filters and plugins Practice Question

An Ansible playbook needs to convert a list of server names into a comma-separated string for an API call. Which filter should be applied to the list variable 'server_list'?

⚠ Common exam trap

Many exam-takers confuse `join` with `combine` (which works on dicts) or attempt to use regex filters on lists, not realizing that `join` is the only filter that directly converts a list to a delimited string.

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

✓

join(',')

The `join` filter in Ansible is designed to concatenate list elements into a single string using a specified delimiter. Applying `join(',')` to `server_list` will produce a comma-separated string, exactly as required for the API call.

Answer analysis

Option-by-option breakdown

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

  • ✗

    map('regex_replace', '^', '')

    Why it's wrong here

    regex_replace substitutes matched patterns within each element, so mapping it over the list returns a list, not a joined string; the empty-match pattern changes nothing. It is used for in-place text substitution inside individual strings, which would be correct if each server name needed reformatting rather than concatenation.

  • ✗

    combine(',')

    Why it's wrong here

    combine merges dictionaries, not lists, so passing a comma string raises an error instead of producing a delimited string. It is the right filter when recursively merging two or more hash variables, such as layering default and override configuration dictionaries, not for joining list elements.

  • ✓

    join(',')

    Why this is correct

    The join filter concatenates list elements into a single string using the supplied separator, so join(',') converts server_list into the comma-separated value the API expects. It operates directly on the list without requiring a loop.

  • ✗

    regex_replace('\n', ',')

    Why it's wrong here

    regex_replace operates on a string, so applying it to a list fails; even on a string it replaces newline characters, and the list contains no newlines. It is correct when normalising multi-line text output, such as converting line breaks in a registered command's stdout into commas.

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 →

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.