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
become: true
template:
src: my.service.j2
dest: "/lib/systemd/system/my.service"
mode: "0644"
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