Last active
August 29, 2015 14:07
-
-
Save kaz-tk/4315ec451f7a594bdfdc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from jinja2 import Environment, FileSystemLoader | |
import yaml | |
vars={} | |
var_files=[ | |
‘some_vars.yml', | |
] | |
for var_file in var_files: | |
stream = file(var_file, 'r') | |
var=yaml.load(stream) | |
stream.close() | |
vars.update(var) | |
files=[ | |
'some_template.conf' | |
] | |
env = Environment( | |
loader = FileSystemLoader('.', encoding='utf-8'), | |
autoescape = False) | |
for f in files: | |
template = env.get_template(f) | |
print template.render(vars) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment