sending vars to templates

Hi,

I have a simple template and it uses some vars.
now I need to send vars to it when invoking the actions

I’m planning to use the single template in few places, so I need send vars in each template action call? Is it possible?

I would expect something like below

- name: git repo 1
action: template src=templates/git-repo-init.sh.j2 dest=/tmp/git-repo-init-1.sh
vars:
app:sidebar
repo:"git@github.com:arunoda/aa.git"

- name: git repo2
action: template src=templates/git-repo-init.sh.j2 dest=/tmp/git-repo-init-2.sh
vars:
app:sidebar2
repo:"git@github.com:arunoda/aa2.git"

Thanks.

you can do it liek this:

  • name: git repo
    action: template src=templates/git-repo-init.sh.j2 dest=/tmp/git-repo-init-{{item.number}}.sh
    with_items:
  • number: 1
    app: sidebarrepo: “git@github.com:arunoda/aa.git”
  • number: 2
    app: sidebar2
    repo: “git@github.com:arunoda/aa2.git”

in template you refer to the vars as item.app and item.repo