# Custom name for a template's temporary file name?

**URL:** <https://forum.ansible.com/t/custom-name-for-a-templates-temporary-file-name/35422>\
**Category:** Ansible Project\
**Created:** [June 28, 2021, 10:05am UTC](https://forum.ansible.com/t/custom-name-for-a-templates-temporary-file-name/35422 "2021-06-28T10:05:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [June 28, 2021, 10:05am UTC](https://forum.ansible.com/t/custom-name-for-a-templates-temporary-file-name/35422/1 "2021-06-28T10:05:09Z")

</div>

Hi

I'm trying to verify systemd unit files that we deploy with the  
template module like this:

- name: Add systemd unit for our service  
&nbsp;&nbsp;become: true  
&nbsp;&nbsp;template:  
&nbsp;&nbsp;&nbsp;&nbsp;src: my.service.j2  
&nbsp;&nbsp;&nbsp;&nbsp;dest: "/lib/systemd/system/my.service"  
&nbsp;&nbsp;&nbsp;&nbsp;mode: "0644"  
&nbsp;&nbsp;&nbsp;&nbsp;validate: systemd-analyze verify %s

But this fails with:

Failed to prepare filename  
/home/admin/.ansible/tmp/ansible-tmp-1624873742.536465-92105-76192242530114/source:  
Invalid argument

This is because 'systemd-analyze verify' insists on the service file  
to have a '.service' extension.  
I've confirmed this by manually running things:

cd /home/admin/.ansible/tmp/ansible-tmp-1624873742.536465-92105-76192242530114/  
cp source source.service

systemd-analyze verify source  
Failed to prepare filename source: Invalid argument  
echo $?  
1

systemd-analyze verify source.service  
echo $?  
0

Is there some way to force the tmpfiles that are used by the template  
module to have a certain extension?

Thx!

Dick
