service: Move mount variable definitions form set_fact to vars
This commit is contained in:
@@ -1,7 +1,42 @@
|
||||
---
|
||||
_service_template_mounts: "{{ service_container_mounts | selectattr('type', '==', 'template') | list }}"
|
||||
_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_setup_database: "{{ service_database_type != 'none' }}"
|
||||
_service_database_name: "{{ service_name }}-{{ service_database_type }}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user