service: Support publishing arbitary ports through sockets
This commit is contained in:
21
roles/service/vars/main/publish_ports.yaml
Normal file
21
roles/service/vars/main/publish_ports.yaml
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
_service_container_publish_ports_with_defaults: >-
|
||||
{{
|
||||
([{ 'type': 'port', 'host_address': '0.0.0.0' }] * service_container_publish_ports | length)
|
||||
| zip(service_container_publish_ports)
|
||||
| map('combine')
|
||||
}}
|
||||
|
||||
_service_container_publish_socket_ports: >-
|
||||
{{ _service_container_publish_ports_with_defaults | selectattr('type', '==', 'socket') }}
|
||||
_service_container_publish_port_ports: >-
|
||||
{{ _service_container_publish_ports_with_defaults | selectattr('type', '==', 'port') }}
|
||||
|
||||
_service_container_publish_ports: >-
|
||||
{{
|
||||
_service_container_publish_port_ports | map(attribute='host_address') |
|
||||
zip(
|
||||
_service_container_publish_port_ports | map(attribute='host_port'),
|
||||
_service_container_publish_port_ports | map(attribute='container_port')
|
||||
) | map('join', ':')
|
||||
}}
|
||||
Reference in New Issue
Block a user