Search code examples
jinja2salt-project

Rendering Saltstack States


How do I render an SLS file in salt-stack which have jinja, multiple pillars and grains in it.

I need to save the rendered file in yaml file.

I already tried show.state module and cp.get_templete module, but am unable to achieve the desired output.


Solution

  • The state.show_sls module allow you to display the state data from a specific sls on the salt-master.

    salt '*' state.show_sls mysls --out=yaml
    

    The --output option allows you to specify an alternative outputter to display the return of data. Salt will fall back on the pprint outputter.

    Note: for top.sls files you should use show_top instead.

    See the state.show_sls and output modules documentation for more information.