Skip to content

Instantly share code, notes, and snippets.

@oharsta
Created February 12, 2025 10:05
Show Gist options
  • Save oharsta/42306e889b41f1de5cfda262da48099f to your computer and use it in GitHub Desktop.
Save oharsta/42306e889b41f1de5cfda262da48099f to your computer and use it in GitHub Desktop.
Testing ansible templates in python
from jinja2 import Template
template = Template("""
{% for lang in my_var.split(',') %}
Language: {{ lang }}
{% endfor %}
""")
output = template.render(my_var="en,nl")
print(output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment