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.
More on Variables, Facts and Templates
A variable you set in `group_vars` is being overridden and you do not know where. How do you find the source?IntermediateYou need different values per environment without copying playbooks.BeginnerYou must render an Nginx config with one `server` block per site from a list.IntermediateA template needs the IPs of all hosts in the `db` group, for example for a replication config.IntermediateNothing should be rendered unless a mandatory variable is supplied.BeginnerPer-host values, like `server_id` for MySQL, must be unique and stable.Intermediate