Hi Julian,
when using configuration management tools like ansible it's nice to have a
method to validate a templated sources.list/.sources file before writing it to
it's final location, e.g.
apt-validate /tmp/tmp.ptsTUMNbEH/kubernetes.sources
All the tool needs to do is return zero when it parses fine, and one when
there's a syntax error.
tools like systemd, borgmatic, sshd, icinga2, etc. have similar options.
This would allow to use following task in ansible:
- name: Template .sources file
template:
src: sources.j2
dest: /etc/apt/sources.list.d/{{ name }}.sources
owner: root
group: root
mode: "0644"
validate: '/usr/sbin/apt-validate %s'
notify: apt update
in the case of an error the destination file never gets written, preventing apt
from breaking and requiring manual intervention.
Hope I could explain why it would be nice to have, let me know if you have any
questions.
Greets,
Lee