39 lines
1.2 KiB
YAML
39 lines
1.2 KiB
YAML
---
|
|
_service_volume_mounts: "{{ service_container_mounts | selectattr('type', '==', 'volume') }}"
|
|
_service_template_mounts: "{{ service_container_mounts | selectattr('type', '==', 'template') }}"
|
|
_service_host_directory: "/srv/{{ service_name }}"
|
|
|
|
_service_container_volume_mounts: >-
|
|
{{
|
|
_service_volume_mounts |
|
|
zip(
|
|
_service_volume_mounts |
|
|
map(attribute='source') |
|
|
map('regex_replace', '^', service_name ~ '-') |
|
|
map('community.general.dict_kv', 'source')
|
|
) |
|
|
map('combine')
|
|
}}
|
|
_service_container_bind_mounts: "{{ service_container_mounts | selectattr('type', '==', 'bind') }}"
|
|
_service_container_template_mounts: >-
|
|
{{
|
|
([{'readonly': true}] * _service_template_mounts | length) |
|
|
zip(
|
|
_service_template_mounts,
|
|
_service_template_mounts |
|
|
map(attribute='source') |
|
|
map('regex_replace', '\.j2$', '') |
|
|
map('regex_replace', '^', _service_host_directory ~ '/mounts/') |
|
|
map('community.general.dict_kv', 'source'),
|
|
([{'type': 'bind'}] * _service_template_mounts | length)
|
|
) |
|
|
map('combine')
|
|
}}
|
|
|
|
_service_container_mounts: >-
|
|
{{
|
|
_service_container_volume_mounts +
|
|
_service_container_bind_mounts +
|
|
_service_container_template_mounts
|
|
}}
|