Hi,
my goal is to use multiple dictionaries within a template. I want one file per username with all projects in it of this user.
My playbook looks like:
- name: create files template: src=vhost.conf.j2 dest=/tmp/{{ item.0.username }}.conf with_subelements: - "{{ users }}" - projects vars: users: - username: jon password: 123456 sftp: True projects: - projectname: Projekt1 documentroot: root1 - projectname: Projekt2 documentroot: root2 - username: jane password: 123456 projects: - projectname: Projekt3 documentroot: root3 - projectname: Projekt4 documentroot: root4
How does a working {% for %} loop needs to look like in the template file? Let's say I want to insert all projectnames of each username in a per username file?
Thanks for helping me out!