title: How to use salt to test out jinja functionality?
body: <p>I am looking for a way to test if salt would render a jinja template the way I expect it to.</p>
  
  <p>If I have a file <code>template.sls</code> containing:</p>
  
  <pre><code>{% for usr in ['moe','larry','curly'] %}
  {{ usr }}:
    user.present
  {% endfor %}
  </code></pre>
  
  <p>Can I run a salt command that will show me the rendered template?</p>
  
  <p>NB: I understand that what's happening is Jinja doing the rendering, and I can template it in python. But I want to ensure that I am using the Jinja version used by salt. AFAIK salt embeds the jinja engine.</p>
  
  <p>An example of what I am looking for is a salt command that would function similarly to the following ansible command:</p>
  
  <p><strong>The following was taken from accepted answer to:</strong> <a href="https://stackoverflow.com/questions/35407822/how-can-i-test-jinja2-templates-in-ansible/35407823#35407823">How can I test jinja2 templates in ansible?</a></p>
  
  <p><strong>3_Ansible</strong> (using --check)
  <br>Create test playbook jinja2test.yml:</p>
  
  <pre><code>---
  - hosts: 127.0.0.1
    tasks:
    - name: Test jinja2template
      template: src=test.j2 dest=test.conf
  </code></pre>
  
  <p>and run it:</p>
  
  <pre><code>ansible-playbook jinja2test.yml --check --diff --connection=local
  </code></pre>
  
  <p>sample output:</p>
  
  <pre><code>PLAY [127.0.0.1] **************************************************************
  
  GATHERING FACTS ***************************************************************
  
  ok: [127.0.0.1]
  
  TASK: [Test jinja2template] ***************************************************
  --- before: test.conf
  +++ after: /Users/user/ansible/test.j2
  @@ -0,0 +1,4 @@
  +Mike
  +Smith
  +Klara
  +Alex
  
  changed: [127.0.0.1]
  
  PLAY RECAP ********************************************************************
  127.0.0.1                  : ok=2    changed=1    unreachable=0    failed=0
  </code></pre>