# Template module question

**URL:** <https://forum.ansible.com/t/template-module-question/17055>\
**Category:** Ansible Project\
**Created:** [December 15, 2014, 12:19am UTC](https://forum.ansible.com/t/template-module-question/17055 "2014-12-15T00:19:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dmitry\_Moskowski](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@Dmitry\_Moskowski](https://forum.ansible.com/u/Dmitry_Moskowski)\
**Post date:** [December 15, 2014, 12:19am UTC](https://forum.ansible.com/t/template-module-question/17055/1 "2014-12-15T00:19:33Z")

</div>

Hello.

I am writing a custom module that works with files for my needs(it's  
my first module for Ansible) and I want to have templating system  
support. I have looked at template module source code[1] in core  
modules repository and can't understand... where is the actual module  
code and what is "virtual module"? Maybe someone could provide a  
documentation link on this?

Thanks.

1.  
[https://github.com/ansible/ansible-modules-core/blob/devel/files/template.py#L1](https://github.com/ansible/ansible-modules-core/blob/devel/files/template.py#L1)

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [December 15, 2014, 1:26pm UTC](https://forum.ansible.com/t/template-module-question/17055/2 "2014-12-15T13:26:24Z")

</div>

I am not sure if I scrubbed any/all references to a “virtual module” yet, but that what really means is an “action\_plugin”.

The template module for instance consists of componentry that runs on the ansible control machine (the action\_plugin “template”) as well as the remote side (the regular module “template”).

(More of a topic for ansible-devel list really)

Anyhow, the template action\_plugin isn’t really easily reusable, due to the way it’s written to just pair with the “template” module on the other side.

---

<div class="post-metadata">

**Author:** ![Dmitry\_Moskowski](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@Dmitry\_Moskowski](https://forum.ansible.com/u/Dmitry_Moskowski)\
**Post date:** [December 15, 2014, 7:13pm UTC](https://forum.ansible.com/t/template-module-question/17055/3 "2014-12-15T19:13:40Z")

</div>

Thanks for the help, now I understand.

For other peoples who could google this thread:  
The actual code of a template module here[1].

1.  
[https://github.com/ansible/ansible/blob/devel/lib/ansible/runner/action\_plugins/template.py](https://github.com/ansible/ansible/blob/devel/lib/ansible/runner/action_plugins/template.py)

> I am not sure if I scrubbed any/all references to a "virtual  
> module" yet, but that what really means is an "action\_plugin".
> 
> The template module for instance consists of componentry that runs  
> on the ansible control machine (the action\_plugin "template") as  
> well as the remote side (the regular module "template").
> 
> (More of a topic for ansible-devel list really)
> 
> Anyhow, the template action\_plugin isn't really easily reusable,  
> due to the way it's written to just pair with the "template" module  
> on the other side.
> 
> Hello.
> 
> I am writing a custom module that works with files for my  
> needs(it's my first module for Ansible) and I want to have  
> templating system support. I have looked at template module source  
> code[1] in core modules repository and can't understand... where is  
> the actual module code and what is "virtual module"? Maybe someone  
> could provide a documentation link on this?
> 
> Thanks.
> 
> 1.
> 
> [https://github.com/ansible/ansible-modules-core/blob/devel/files/template.py#L1](https://github.com/ansible/ansible-modules-core/blob/devel/files/template.py#L1)
> 
> >

- --

> > 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  
> > ansible-project+unsubscribe@googlegroups.com. To post to this  
> > group, send email to ansible-project@googlegroups.com. To view  
> > this discussion on the web visit  
> > [https://groups.google.com/d/msgid/ansible-project/548E2915.6080601%40corpix.ru](https://groups.google.com/d/msgid/ansible-project/548E2915.6080601%40corpix.ru)

.
