Skip to content

Instantly share code, notes, and snippets.

@versionsix versionsix/alpha.j2
Created Nov 28, 2018

Embed
What would you like to do?
Ansible nested template with loop and variable
Alpha-file
{% for student in students %}
{{ lookup('template','beta.j2') }}
{%endfor%}
Beta-File
I want to access variable student here
{{student}}
---
- hosts: localhost
connection: local
gather_facts: false
vars:
students:
- Alex
- Ruby
tasks:
- debug:
msg: "{{ lookup('template','alpha.j2')}}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.