69 lines
1.9 KiB
YAML
69 lines
1.9 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
|
|
}}
|
|
|
|
|
|
_service_all_template_mounts: >-
|
|
{{
|
|
(
|
|
_service_template_mounts +
|
|
(
|
|
_service_additional_containers |
|
|
map(attribute='mounts') |
|
|
flatten
|
|
)
|
|
) |
|
|
selectattr('type', '==', 'template') |
|
|
unique
|
|
}}
|
|
_service_all_template_mount_directories: >-
|
|
{{
|
|
_service_all_template_mounts |
|
|
map(attribute='source') |
|
|
map('dirname') |
|
|
unique |
|
|
select('!=', '')
|
|
}}
|
|
_service_all_template_mount_host_files: >-
|
|
{{
|
|
_service_all_template_mounts |
|
|
map(attribute='source') |
|
|
map('regex_replace', '\.j2$', '') |
|
|
map('regex_replace', '^', _service_host_directory ~ '/mounts/')
|
|
}}
|