Thanks -- that worked, e.g.:

{% import 'roles/other_role/templates/foo.j2' as foo with context %}

Jacob


On Thursday, February 12, 2015 at 5:59:08 PM UTC-8, Giovanni Tirloni wrote:
>
> On Wed, 11 Feb 2015 11:11 -0800, Jacob Weber <[email protected] 
> <javascript:>> 
> 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/7228e4e2-a52d-481f-95b4-d05a21572b1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to