Skip to content

Instantly share code, notes, and snippets.

@sivel
Created August 23, 2018 16:15
Show Gist options
  • Save sivel/ba548663c87857cbf3ddf7e2a8b537ae to your computer and use it in GitHub Desktop.
Save sivel/ba548663c87857cbf3ddf7e2a8b537ae to your computer and use it in GitHub Desktop.
[localhost] TASK: install package (debug)> from jinja2 import Environment
[localhost] TASK: install package (debug)> e = Environment()
[localhost] TASK: install package (debug)> t = e.from_string(task.args['msg'])
[localhost] TASK: install package (debug)> t.render(task_vars)
'foo'
or
[localhost] TASK: install package (debug)> from ansible.template import Templar
[localhost] TASK: install package (debug)> templar = Templar(loader=None, variables=task_vars)
[localhost] TASK: install package (debug)> templar.template(task.args['msg'])
'foo'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment