Skip to content

Instantly share code, notes, and snippets.

@blarghmatey
Last active March 2, 2016 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blarghmatey/51675ebd04e2b4947855 to your computer and use it in GitHub Desktop.
Save blarghmatey/51675ebd04e2b4947855 to your computer and use it in GitHub Desktop.
{%- macro render_yaml(config_dict, offset=2) -%}
{%- for key, value in config_dict.items() -%}
{%- if value is mapping -%}
{{ key }}:
{{ render_yaml(value)|indent(offset) }}
{%- elif value is list -%}
{{ key }}:
{% for v in value -%}
- {{ v }}
{% endfor -%}
{%- else -%}
{{ key|indent(offset) }}: {{ value }}
{% endif -%}
{%- endfor -%}
{%- endmacro -%}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment