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 %}

Why would that second version fail? Is there another way to do this?

Thanks,
Jacob

-- 
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/52a9f3ac-94e2-4075-a6c3-662dfb3f9983%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to