How to examine Jinja output in Saltstack? I have a templated SLS in Salt I'm trying to build, but it's emitting invalid syntax, which is resulting in errors such as:

my-minion-id:
    - State 'system' in SLS 'network' is not formed as a list


In principle, it should be possible to, somehow examine the output of the Jinja template before it attempts to parse the output as an SLS file. There exists a Python module for the Jinja renderersalt.renderers.jinja, but if I attempt to execute it on the CLI, I get an error:

# salt my-minion-id salt.renderers.jinja.render /srv/salt/network/init.sls
my-minion-id:
    'salt.renderers.jinja.render' is not available.
ERROR: Minions returned with non-zero exit code
# salt my-minion-id renderers.jinja.render /srv/salt/network/init.sls
my-minion-id:
    'renderers.jinja.render' is not available.
ERROR: Minions returned with non-zero exit code


How can I see the output of my template? It seems absurd it should be this difficult to debug.
Check out the slsutil.renderer module.

This should do what you want

salt my-minion-id slsutil.renderer /srv/salt/network/init.sls 'jinja'


This module just calls the compile_template function directly for you.

Edit: /srv/salt/network/init.sls is the path on the minion, if you are not targeting the master as your minion, you will probably need to do the following.

salt minion-id cp.cache_file salt://network/init.sls
salt minion-id slsutil.renderer /var/cache/salt/minion/files/base/network/init.sls


or point to whatever file that cache_file spits out.

If you are on 2018.3 or newer, you can just specify salt://network/init.sls