container: add copypath mounts for copying whole directories to mount in container

This commit is contained in:
uumas
2023-12-21 01:07:40 +02:00
parent d76dbf6e3c
commit 3e9ea95ad7
3 changed files with 20 additions and 2 deletions

View File

@@ -35,6 +35,19 @@
when: item.template is defined
loop: "{{ docker_mounts }}"
- name: Copy docker copypath mounts for {{ docker_service_name }}
copy:
src: "files/{{ item.copypath }}"
dest: "{{ docker_mounts_dir }}/"
when: item.copypath is defined
loop: "{{ docker_mounts }}"
notify: Restart container {{ docker_service_name }}
- name: Set docker_volume_definition for copypath mounts
set_fact:
docker_volume_definition: "{{ docker_volume_definition + [{'source': docker_mounts_dir + '/' + item.copypath, 'target': item.path, 'type': 'bind', 'read_only': true}] }}"
when: item.copypath is defined
loop: "{{ docker_mounts }}"
- name: Set docker_volume_definition for named volumes
set_fact:
docker_volume_definition: "{{ docker_volume_definition + [{'source': docker_service_name + '_' + item.name, 'target': item.path, 'type': 'volume'}] }}"