service: Support publishing arbitary ports through sockets

This commit is contained in:
uumas
2026-03-12 00:32:10 +02:00
parent 470b60f988
commit 294b931d19
7 changed files with 122 additions and 5 deletions

View File

@@ -37,7 +37,7 @@
container_user: "{{ service_container_user }}"
container_mounts: "{{ _service_container_mounts }}"
container_devices: "{{ service_container_devices }}"
container_publish_ports: "{{ service_container_publish_ports }}"
container_publish_ports: "{{ _service_container_publish_ports }}"
container_networks: "{{ _service_container_networks }}"
container_ip: "{{ service_container_ip }}"
container_secrets: "{{ _service_container_secrets }}"
@@ -47,7 +47,7 @@
container_wants: "{{ _service_container_wants }}"
container_auto_update: "{{ service_auto_update }}"
- name: Socat for {{ service_name }}
- name: Socat for http of {{ service_name }}
ansible.builtin.include_role:
name: socat
when: service_container_http_port > 0
@@ -58,6 +58,18 @@
{{ service_container_ip | ansible.utils.ipmath(3) if _service_static_ip else '' }}
socat_auto_update: "{{ service_auto_update }}"
- name: Socat for socket published ports of {{ service_name }}
ansible.builtin.include_role:
name: socat
loop: "{{ _service_container_publish_socket_ports }}"
loop_control:
loop_var: publish_port
vars:
socat_service_name: "{{ service_name }}-{{ publish_port.name }}"
socat_target_container: "{{ service_name }}"
socat_target_http_port: "{{ publish_port.container_port }}"
socat_auto_update: "{{ service_auto_update }}"
- name: Reverse proxy for {{ service_name }}
ansible.builtin.include_tasks: proxy.yaml
when: service_domains | length > 0