container: Allow custom ip addresses for more than one network

This commit is contained in:
uumas
2026-03-14 23:33:04 +02:00
parent ca29ffb271
commit f64ea2cbe3
14 changed files with 82 additions and 71 deletions

View File

@@ -1,10 +1,20 @@
---
_service_container_networks: >-
{{
[service_name]
+ service_container_additional_networks
+ ([service_name ~ '-socat'] if service_container_http_port > 0 else [])
+ (_service_container_publish_socket_ports | map(attribute='name') | map('regex_replace', '^', service_name ~ '-'))
[{
'name': service_name,
'ip': service_container_ip
}]
+ (
[{
'name': service_name ~ '-socat',
'ip': service_container_ip | ansible.utils.ipmath(256) if _service_static_ip else ''
}] if service_container_http_port > 0 else []
)
+ (
service_container_additional_networks
+ (_service_container_publish_socket_ports | map(attribute='name') | map('regex_replace', '^', service_name ~ '-'))
) | map('community.general.dict_kv', 'name')
}}
_service_static_ip: "{{ service_container_ip | length > 0 }}"