# Invoke Jinja2 template in a custom module

**URL:** <https://forum.ansible.com/t/invoke-jinja2-template-in-a-custom-module/24409>\
**Category:** Ansible Project\
**Created:** [May 6, 2017, 12:24am UTC](https://forum.ansible.com/t/invoke-jinja2-template-in-a-custom-module/24409 "2017-05-06T00:24:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rama\_Krishna](https://avatars.discourse-cdn.com/v4/letter/r/ecd19e/32.png) [@Rama\_Krishna](https://forum.ansible.com/u/Rama_Krishna)\
**Post date:** [May 6, 2017, 12:24am UTC](https://forum.ansible.com/t/invoke-jinja2-template-in-a-custom-module/24409/1 "2017-05-06T00:24:03Z")

</div>

Hi Fellas,  
I’m trying to invoke jinja2 template to a custom module, but it end up i get only a string of file name instead of calling ansible container to get the jinja2 output.

On debug i see, when the default modules call jinja2 template it automatically parses, but on custom modules it’s not getting parsed. How do I let the module know to parse the jinja2 template. ?

Sample code:  
tasks:

- my\_custom\_module:  
source: shell\_commands.j2

On execution: source is assigned with just a string instead of parsing the j2 template.

Thanks in advance… !
