I have a Jinja2 template and I want to pass args to it from my vars/main.yml
.
For each set of vars, I need to generate a separate file on the remote server.
My vars/main.yml
has the following structure:
List:
- { src: [
classPath1: xxx,
classPath2: xxx,
contxtHost: xxx,
logDir: xxx,
contxtRegion: xxx,
....
],
dest: xxxx
}
- { src: [
xxxx
],
dest: xxxx
}
in my playbook task is defined as below:
- name: testing templates
template: "src=templates/sampletest.j2
dest=/path/in/Server/{{ item.dest }}
owner=app
group=app
mode=0644"
with_items: '{{ List }}'
How do I pass item.src
to my template?
Note: I am trying to generate multiple files based on each set of vars item.src
and file name is item.dest
using with_items
.