List in lists in jinja2 template

Viewed 3607

I have the following variables defined:

datasources:
  - { name: 'dsname', target: ['server1', 'server2'] }

Running the following playbook:

---
- name: Create file
  template: src="datasource.py" dest="/tmp/datasource.py"

The Jinja template i am trying to build from is the following:

{% for ds_target in datasources.target 
%} Target:{{ ds_target }} {%
endfor %}

How can I do the template to have the following output?

Target:server1 Target:server2 

Any tip would be highly appreciated

3 Answers
Related