Invoke Jinja2 template in a custom module

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… !