Interview Prep/Ansible/Variables, Facts and Templates

A list of strings in a variable needs to be passed as a comma-separated argument.

BeginnerScenarioVariables, Facts and Templates
Answer

Situation read → Basic filter use.

What I'd do →

servers: [a, b, c]
line: "{{ servers | join(',') }}"

Why → join is a Jinja filter; others you will use daily are default, map, select, regex_replace, to_nice_json.

Interview tip → Know map(attribute='name') | list for extracting a field from a list of dicts.

All Ansible questions Roadmap: Ansible

More on Variables, Facts and Templates