# Ansible include files

**URL:** <https://forum.ansible.com/t/ansible-include-files/28930>\
**Category:** Ansible Project\
**Created:** [November 2, 2018, 5:02pm UTC](https://forum.ansible.com/t/ansible-include-files/28930 "2018-11-02T17:02:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rjbotham](https://avatars.discourse-cdn.com/v4/letter/r/ecae2f/32.png) [@rjbotham](https://forum.ansible.com/u/rjbotham)\
**Post date:** [November 2, 2018, 5:02pm UTC](https://forum.ansible.com/t/ansible-include-files/28930/1 "2018-11-02T17:02:05Z")

</div>

Hi All,

Would appreciate any help on this one

I have 3 files in the /include directory and i’d like to be able to call/use these from any role.

However, hard as i try can’t get the path to find the include files

If i add this line in a template {% include “…/…/include/jpr\_syslog.j2” %} in the /roles/ex3400/templates/ex3400\_template\_v1.0.j2

I get this

TASK [ex3400 : Generate BSL Single EX3400 Build Config] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [ex3400\_1]: FAILED! =\> {“changed”: false, “failed”: true, “msg”: “TemplateNotFound: …/…/include/jpr\_syslog.j2”}

├── group\_vars  
│ └── small\_office\_vars  
├── host\_vars  
│ ├── ex3400\_1  
│ └── srx\_1  
├── include  
│ ├── jpr\_snmp.j2  
│ ├── jpr\_syslog.j2  
│ └── jpr\_tacacs.j2  
├── roles  
│ ├── ex3400  
│ │ ├── output  
│ │ │ └── ex3400\_1.2.txt  
│ │ ├── tasks  
│ │ │ ├── ex3400\_build.yml  
│ │ │ └── main.yml  
│ │ └── templates  
│ │ └── ex3400\_template\_v1.0.j2  
│ ├── single\_srx  
│ │ ├── output  
│ │ │ └── srx\_1.0.txt  
│ │ ├── tasks  
│ │ │ ├── main.yml  
│ │ │ └── single\_srx\_build.yml  
│ │ └── templates  
│ │ └── srx\_template\_v1.0.j2

Cheers  
Rich

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [November 2, 2018, 5:43pm UTC](https://forum.ansible.com/t/ansible-include-files/28930/2 "2018-11-02T17:43:30Z")

</div>

Use relative from where you run ansible-playbook so probably

{% include "include/jpr\_syslog.j2" %}
