service: Support validating templated files

This commit is contained in:
uumas
2026-06-08 17:30:07 +03:00
parent 40357a17ad
commit 3e84073f39
4 changed files with 18 additions and 2 deletions

View File

@@ -23,8 +23,16 @@
src: "{{ item[0].source }}"
dest: "{{ item[1] }}"
mode: "{{ item[0].mode | default('0644') }}"
validate: "{{ validate if item[0].template_validate_command is defined else omit }}"
notify: Restart container service {{ service_name }}
loop: "{{ _service_all_template_mounts | zip(_service_all_template_mount_host_files) }}"
vars:
validate: >-
podman run --rm
-v %s:{{ item[0].destination }}:ro
--entrypoint {{ item[0].template_validate_command.split(' ', 1)[0] }}
{{ service_container_image }}
{{ item[0].template_validate_command.split(' ', 1)[1] }}
- name: Copy files for copy mounts
ansible.builtin.copy: