On Wed, 11 Feb 2015 11:11 -0800, Jacob Weber <[email protected]>
wrote:
> One of my roles uses a template, which has an {% import ... %} statement
> to 
> include data from another template.
> 
> I'd like this other template to be outside of the role's "templates" 
> directory, since it will be shared by multiple roles.
> 
> If I try including a relative path:
>   {% import ../../../foo.j2 as foo with context %}
> it fails with the error "Cannot find/not allowed to load (include) 
> template". I think this is because Jinja2 won't include paths with ".."
> in 
> them.
> 
> But it also fails if I include an absolute path, using playbook_dir:
> 
>   {% import playbook_dir ~ '/foo.j2' as foo with context %}

The "template" plugin will use the runner's basedir, so try to specify a
path relative to the playbook's directory.

Giovanni

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1423792741.1077873.226927885.599D9DC7%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to