Launching LXD images using templates

This is the solution (one solution at least) for including a file with the file path coming as a setting (e.g. from a profile).

These are the contents of the template file:

{% if config_get("environment.env", "") == "prod" %}
    {% with filename=config_get("environment.templatepath", "")|add:"/prod.txt" %}
            {% include filename %}
    {% endwith %}
{% else %}
    {% with filename=config_get("environment.templatepath", "")|add:"/test.txt" %}
            {% include filename %}
    {% endwith %}
{% endif %}

Great success!

Thanks!

1 Like