Skip to content

Instantly share code, notes, and snippets.

@gladiatr72
Last active April 7, 2016 17:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gladiatr72/8552f9048f37485de05cce8e4914d89c to your computer and use it in GitHub Desktop.
Save gladiatr72/8552f9048f37485de05cce8e4914d89c to your computer and use it in GitHub Desktop.
reading a saltstack jinja template
some_variable = {{some_variable}}
from salt.utils.templates import JINJA
from salt.conf import minion_config
__opts__ = minion_config('/etc/salt/minion')
full_path='/var/tmp/jinja_test.sls'
ctx = {
'opts': __opts__,
'saltenv': 'base',
'some_variable': 'things and such'
}
R = JINJA(full_path, to_str=True, **ctx)['data']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment