# Delegate with template with source file on remote

**URL:** <https://forum.ansible.com/t/delegate-with-template-with-source-file-on-remote/23345>\
**Category:** Ansible Project\
**Created:** [December 29, 2016, 10:47am UTC](https://forum.ansible.com/t/delegate-with-template-with-source-file-on-remote/23345 "2016-12-29T10:47:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mehdi\_B](https://avatars.discourse-cdn.com/v4/letter/m/e480ec/32.png) [@Mehdi\_B](https://forum.ansible.com/u/Mehdi_B)\
**Post date:** [December 29, 2016, 10:47am UTC](https://forum.ansible.com/t/delegate-with-template-with-source-file-on-remote/23345/1 "2016-12-29T10:47:06Z")

</div>

Hi,

I have a project where I wanted to use templates but instead of having them on ansible server, I wanted to use a remote file and deploy it.

Why? As I’m cloning site project on remote front servers, and the template is in the project so dev’s could update it.

So I have server 1 ( ansible controller )

Server 2 ( target ) with template.php.dist file on /home

I created a role with main task:

- name: Create conf config/template.php  
template: \>  
src=“/home/template.php.dist”  
dest=“/home/licom.php”  
delegate\_to: “{{ item }}”  
with\_items:
- “{{ inventory\_hostname }}”

So I delegate the task to execute on server 2 here but seem that the template will always check for server 1 as source. Is there a way to changer the source server? So I won’t need to clone the entire project on server 1?

Thanks  
Mehdi B

---

<div class="post-metadata">

**Author:** ![Mehdi\_B](https://avatars.discourse-cdn.com/v4/letter/m/e480ec/32.png) [@Mehdi\_B](https://forum.ansible.com/u/Mehdi_B)\
**Post date:** [December 29, 2016, 10:52am UTC](https://forum.ansible.com/t/delegate-with-template-with-source-file-on-remote/23345/2 "2016-12-29T10:52:58Z")

</div>

After checking the archive:  
[https://groups.google.com/forum/#!topic/ansible-project/HqCymjQoVjc](https://groups.google.com/forum/#!topic/ansible-project/HqCymjQoVjc)

Seem the point here as we need jinja2 on remote server too and python. So best is festching it once using

[http://docs.ansible.com/ansible/fetch\_module.html](http://docs.ansible.com/ansible/fetch_module.html)

Then pushing back the file.

If anyone have better idea you are welcome.

Mehdi B
