How to include/extend Jinja2 template string variable in another variable
<p>Trying to make the code DRYer by nesting templates like this:</p>

<pre><code>base = Template('''
  - alert:
     cluster: {{cluster}}
     role: {{role}}
     slack: {{slack}}
''')

alert = Template('''
    {% include base %}
     description: Critical {{role}} system load
     threshold: xxx-yyy-zzz
''')

print alert.render(cluster='cluster1', slack='alerts', role='database')
</code></pre>

<p>The above does not work, getting the exception:</p>

<pre><code>  File "/usr/local/lib/python2.7/site-packages/jinja2/environment.py", line 989, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/local/lib/python2.7/site-packages/jinja2/environment.py", line 754, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "&lt;template&gt;", line 2, in top-level template code
TypeError: no loader for this environment specified
</code></pre>

<p>Please advise.</p>