# template module bombing out

**URL:** <https://forum.ansible.com/t/template-module-bombing-out/15884>\
**Category:** Ansible Project\
**Created:** [August 7, 2014, 9:41pm UTC](https://forum.ansible.com/t/template-module-bombing-out/15884 "2014-08-07T21:41:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Oliver](https://avatars.discourse-cdn.com/v4/letter/j/97f17d/32.png) [@John\_Oliver](https://forum.ansible.com/u/John_Oliver)\
**Post date:** [August 7, 2014, 9:41pm UTC](https://forum.ansible.com/t/template-module-bombing-out/15884/1 "2014-08-07T21:41:23Z")

</div>

ansible 1.6.10

This task:

- name: Copy admin pwd chg ldif to target  
template: src=admin-pwd-chg.ldif.j2 dest=/tmp/

is leaving /tmp/admin-pwd-chg.ldif.j2 instead of admin-pwd-chg.ldif The variables in it are being expanded.

-vvvv output:

TASK: [apacheds | Copy admin pwd chg ldif to target] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
 ESTABLISH CONNECTION FOR USER: joliver  
 EXEC [‘ssh’, ‘-C’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/Users/joliver/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘ConnectTimeout=10’, ‘jedis-test’, “/bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1407442699.07-10863228717998 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1407442699.07-10863228717998 && echo $HOME/.ansible/tmp/ansible-tmp-1407442699.07-10863228717998’”]  
 EXEC [‘ssh’, ‘-C’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/Users/joliver/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘ConnectTimeout=10’, ‘jedis-test’, u’/bin/sh -c 'sudo -k && sudo -H -S -p “[sudo via ansible, key=kwyctxvepfhnnbaahrwvljxgtsdvpnur] password: " -u root /bin/sh -c '”'“'echo SUDO-SUCCESS-kwyctxvepfhnnbaahrwvljxgtsdvpnur; rc=0; [-r “/tmp/admin-pwd-chg.ldif.j2”] || rc=2; [-f “/tmp/admin-pwd-chg.ldif.j2”] || rc=1; [-d “/tmp/admin-pwd-chg.ldif.j2”] && echo 3 && exit 0; (/usr/bin/md5sum /tmp/admin-pwd-chg.ldif.j2 2\>/dev/null) || (/sbin/md5sum -q /tmp/admin-pwd-chg.ldif.j2 2\>/dev/null) || (/usr/bin/digest -a md5 /tmp/admin-pwd-chg.ldif.j2 2\>/dev/null) || (/sbin/md5 -q /tmp/admin-pwd-chg.ldif.j2 2\>/dev/null) || (/usr/bin/md5 -n /tmp/admin-pwd-chg.ldif.j2 2\>/dev/null) || (/bin/md5 -q /tmp/admin-pwd-chg.ldif.j2 2\>/dev/null) || (/usr/bin/csum -h MD5 /tmp/admin-pwd-chg.ldif.j2 2\>/dev/null) || (/bin/csum -h MD5 /tmp/admin-pwd-chg.ldif.j2 2\>/dev/null) || (echo “${rc} /tmp/admin-pwd-chg.ldif.j2”)'”'“''‘]  
 PUT /var/folders/67/dk8m\_22d413fhslkhh4dwkzr0000gn/T/tmpkBftoy TO /home/joliver/.ansible/tmp/ansible-tmp-1407442699.07-10863228717998/source  
 PUT /var/folders/67/dk8m\_22d413fhslkhh4dwkzr0000gn/T/tmpKQfnIR TO /home/joliver/.ansible/tmp/ansible-tmp-1407442699.07-10863228717998/copy  
 EXEC [‘ssh’, ‘-C’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/Users/joliver/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘ConnectTimeout=10’, ‘jedis-test’, u’/bin/sh -c 'sudo -k && sudo -H -S -p “[sudo via ansible, key=wdssxeblwbwzcnbalsyidqzsjgqmxxcc] password: " -u root /bin/sh -c '”'”'echo SUDO-SUCCESS-wdssxeblwbwzcnbalsyidqzsjgqmxxcc; LC\_CTYPE=en\_US.UTF-8 LANG=en\_US.UTF-8 /usr/bin/python /home/joliver/.ansible/tmp/ansible-tmp-1407442699.07-10863228717998/copy; rm -rf /home/joliver/.ansible/tmp/ansible-tmp-1407442699.07-10863228717998/ \>/dev/null 2\>&1'“'”''']  
changed: [jedis-test] =\> {“changed”: true, “dest”: “/tmp/admin-pwd-chg.ldif.j2”, “gid”: 0, “group”: “root”, “md5sum”: “47ebafe65449834031c310ceb02b9310”, “mode”: “0611”, “owner”: “root”, “secontext”: “unconfined\_u:object\_r:user\_home\_t:s0”, “size”: 90, “src”: “/home/joliver/.ansible/tmp/ansible-tmp-1407442699.07-10863228717998/source”, “state”: “file”, “uid”: 0}

---

<div class="post-metadata">

**Author:** ![David\_Karban](https://avatars.discourse-cdn.com/v4/letter/d/90db22/32.png) [@David\_Karban](https://forum.ansible.com/u/David_Karban)\
**Post date:** [August 8, 2014, 5:51am UTC](https://forum.ansible.com/t/template-module-bombing-out/15884/2 "2014-08-08T05:51:17Z")

</div>

Hi,

AFAIK it is correct and ansible is doing it at least from 1.1 (when I started with it). If you set only path, template file name is just copied as is in src argument.

template: src=admin-pwd-chg.ldif.j2 dest=/tmp/admin-pwd-chg.ldif

will work.

David

---

<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:** [August 8, 2014, 2:43pm UTC](https://forum.ansible.com/t/template-module-bombing-out/15884/3 "2014-08-08T14:43:24Z")

</div>

When you don’t specify a destination path, it is going to use the filename to decide the filename of the output.

The solution would be to specify the full path to the destination file.
