I have the need to template a yaml file using vars in another yaml file as
input. There are often defaults.
I'd like to do this
in vars.yml
parentvar:
childvar:
subvar1: val1
# subvar2 is not even listed to keep user vars.yml file concise
template.yml
{{ parentvar.childvar.subvar1 }}
{{ parentvar.childvar.subvar2 | default("default for subvar2") }}
This fails with "dict object has no attribute 'subvar2'
It would work fine if i had
vars.yml
parentvar_childvar_subvar1: val1
and template.yml
{{ parentvar_childvar_subvar1 }}
{{ parentvar_childvar_subvar2 | default("default for subvar2") }}
I presume this is a problem at the jinja2 level?
I would like to avoid the '_' flattened solution as it becomes pretty
unreadable for large config files.
Any suggestions on how to work around this?
thanks
Kesten Broughton
512 701 4209