title: How can I test jinja2 templates in ansible?
body: <p>Sometimes I need to test some jinja2 templates that I use in my ansible roles. What is the simplest way for doing this?</p>
  
  <p>For example, I have a template (test.j2):</p>
  
  <pre><code>{% if users is defined and users %}
  {% for user in users %}{{ user }}
  {% endfor %}
  {% endif %}
  </code></pre>
  
  <p>and vars (in group_vars/all):</p>
  
  <pre><code>---
  users:
    - Mike
    - Smith
    - Klara
    - Alex
  </code></pre>