service: Add support for mounting entire copied directory

This commit is contained in:
uumas
2026-01-09 17:24:01 +02:00
parent b2540e2bd3
commit b030d671b5
6 changed files with 79 additions and 7 deletions

View File

@@ -25,3 +25,12 @@
mode: "{{ item[0].mode | default('0644') }}"
notify: Restart container service {{ service_name }}
loop: "{{ _service_all_template_mounts | zip(_service_all_template_mount_host_files) }}"
- name: Copy files for copy mounts
ansible.builtin.copy:
src: "{{ item[0].source }}"
dest: "{{ item[1] }}"
mode: "{{ item[0].mode | default('0644') }}"
directory_mode: "0755"
notify: Restart container service {{ service_name }}
loop: "{{ _service_all_copy_mounts | zip(_service_all_copy_mount_host_files) }}"

View File

@@ -15,8 +15,8 @@
when: _service_container_secrets | length > 0
- name: Template mounts for {{ service_name }}
ansible.builtin.include_tasks: templates.yaml
when: _service_template_mounts | length > 0
ansible.builtin.include_tasks: hostmounts.yaml
when: (_service_template_mounts + _service_copy_mounts) | length > 0
- name: Additional containers for {{ service_name }}
ansible.builtin.include_tasks: additional.yaml

View File

@@ -19,3 +19,9 @@
msg: "Template mount source file name needs to end in .j2. The file {{ item.source }} of {{ service_name }} doesn't."
when: "item.source | split('.') | last != 'j2'"
loop: "{{ _service_template_mounts }}"
- name: Fail if copy mount source doesn't end with /
ansible.builtin.fail:
msg: "Copy mount source name must end with /. The file {{ item.source }} of {{ service_name }} doesn't"
when: "not item.source.endswith('/')"
loop: "{{ _service_copy_mounts }}"