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.





On Fri, Aug 8, 2014 at 1:51 AM, David Karban <[email protected]> wrote:

> 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
>
>
> 2014-08-07 23:41 GMT+02:00 John Oliver <[email protected]>:
>
>> 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]
>> **************************
>> <jedis-test> ESTABLISH CONNECTION FOR USER: joliver
>> <jedis-test> 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'"]
>> <jedis-test> 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")\'"\'"\'\'']
>> <jedis-test> PUT
>> /var/folders/67/dk8m_22d413fhslkhh4dwkzr0000gn/T/tmpkBftoy TO
>> /home/joliver/.ansible/tmp/ansible-tmp-1407442699.07-10863228717998/source
>> <jedis-test> PUT
>> /var/folders/67/dk8m_22d413fhslkhh4dwkzr0000gn/T/tmpKQfnIR TO
>> /home/joliver/.ansible/tmp/ansible-tmp-1407442699.07-10863228717998/copy
>> <jedis-test> 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}
>>
>>  --
>> 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 [email protected].
>> To post to this group, send email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/a03cc003-f0de-4a22-a765-b34abe85a5a2%40googlegroups.com
>> <https://groups.google.com/d/msgid/ansible-project/a03cc003-f0de-4a22-a765-b34abe85a5a2%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> David Karban
> Specialista na správu linuxových serverů
> www.karban.eu
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAOBFM97fmaOD_uqepqwkOso_zQL6Dxppe17ezohyxQqFBg7QEg%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAOBFM97fmaOD_uqepqwkOso_zQL6Dxppe17ezohyxQqFBg7QEg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgwU-sqCQ9p5Wh6PFy7nfcyNVhzKSKbwQvtEUg8zo%3D9qEQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to