# Question about template module

**URL:** <https://forum.ansible.com/t/question-about-template-module/35984>\
**Category:** Ansible Project\
**Created:** [November 10, 2021, 2:36pm UTC](https://forum.ansible.com/t/question-about-template-module/35984 "2021-11-10T14:36:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jcpetro](https://avatars.discourse-cdn.com/v4/letter/j/53a042/32.png) [@jcpetro](https://forum.ansible.com/u/jcpetro)\
**Post date:** [November 10, 2021, 2:36pm UTC](https://forum.ansible.com/t/question-about-template-module/35984/1 "2021-11-10T14:36:04Z")

</div>

Good morning!!

I have a quick question about how the template module works under the hood, that I wasn’t able to find any information on, and was asked about by a coworker.

So, let’s say I have a role where I created a config file from a template. If I run that role a second time, the result comes back having not making any changes, which is what I expect. So the question I have is when I run a playbook against that role multiple times, how does ansible check the value to determine if a change needs to be made or not.

–john

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [November 10, 2021, 2:41pm UTC](https://forum.ansible.com/t/question-about-template-module/35984/2 "2021-11-10T14:41:45Z")

</div>

The template is always generated locally where ansible is executed from. Then we call the `copy` action internally, which will call the `stat` module to get the checksum of the remote file and determine if it exists. If the local checksum and remote checksum matches, the file is not copied to the remote. Afterwards we call the `file` action/module, and potentially modify permissions/ownership/mode on the destination file.

---

<div class="post-metadata">

**Author:** ![jcpetro](https://avatars.discourse-cdn.com/v4/letter/j/53a042/32.png) [@jcpetro](https://forum.ansible.com/u/jcpetro)\
**Post date:** [November 10, 2021, 6:14pm UTC](https://forum.ansible.com/t/question-about-template-module/35984/3 "2021-11-10T18:14:36Z")

</div>

Thanks Matt!! That is the answer I was looking for.

–John
