# FIle not being copied using template

**URL:** <https://forum.ansible.com/t/file-not-being-copied-using-template/25294>\
**Category:** Ansible Project\
**Created:** [August 19, 2017, 11:19am UTC](https://forum.ansible.com/t/file-not-being-copied-using-template/25294 "2017-08-19T11:19:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sinan](https://avatars.discourse-cdn.com/v4/letter/s/f4b2a3/32.png) [@Sinan](https://forum.ansible.com/u/Sinan)\
**Post date:** [August 19, 2017, 11:19am UTC](https://forum.ansible.com/t/file-not-being-copied-using-template/25294/1 "2017-08-19T11:19:06Z")

</div>

I have the following tree;

Root folder: ~/ansible/

I am running the command from the root folder.

Command:

> $ ansible-playbook -i hosts playbook.yml --tags resolvconf --private-key ~/.ssh/hps  
> PLAY [all] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
> TASK [Gathering Facts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
> ok: [172.24.100.2]  
> PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
> 172.24.100.2 : ok=1 changed=0 unreachable=0 failed=0

> $ cat playbook.yml
> 
> - hosts: all  
> user: hps  
> sudo: true  
> roles:
> - role: resolvconf  
> tags:
> - resolv

> ## $ cd ~/ansible/roles/resolvconf/tasks $ cat main.yml
> 
> - name: Copy resolv.conf to /etc/  
> template:  
> src: resolv.conf.j2  
> dest: /etc/resolv.conf  
> owner: root  
> group: root  
> mode: 0644

> $ cd ~/ansible/roles/resolvconf/templates  
> $ cat resolv.conf.j2  
> nameserver 172.24.100.1

Unfortunately /etc/resolv.conf remains unchanged.

What am I missing? Thanks!

---

<div class="post-metadata">

**Author:** ![Sinan](https://avatars.discourse-cdn.com/v4/letter/s/f4b2a3/32.png) [@Sinan](https://forum.ansible.com/u/Sinan)\
**Post date:** [August 19, 2017, 11:20am UTC](https://forum.ansible.com/t/file-not-being-copied-using-template/25294/2 "2017-08-19T11:20:51Z")

</div>

Nevermind, I found it out myself. In my playbook.yml I have named tags “resolv”, it should have been “resolvconf”.
