service: Support publishing arbitary ports through sockets
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
container_entrypoint: "{{ _service_additional_container.entrypoint | default('') }}"
|
||||
container_user: "{{ service_container_user }}"
|
||||
container_mounts: "{{ _service_additional_container_mounts }}"
|
||||
container_publish_ports: "{{ _service_additional_container.publish_ports | default([]) }}"
|
||||
container_publish_ports: "{{ _service_additional_container_publish_ports }}"
|
||||
container_networks: "{{ _service_container_networks }}"
|
||||
container_ip: "{{ _service_additional_container_ip }}"
|
||||
container_secrets: "{{ _service_additional_container.secrets | default(_service_container_secrets) }}"
|
||||
@@ -23,3 +23,9 @@
|
||||
loop_control:
|
||||
loop_var: _service_additional_container
|
||||
index_var: _service_additional_container_index
|
||||
|
||||
- name: Socat sockets for additional containers of {{ service_name }}
|
||||
ansible.builtin.include_tasks: additional_socat.yaml
|
||||
loop: "{{ _service_additional_containers }}"
|
||||
loop_control:
|
||||
loop_var: _service_additional_container
|
||||
|
||||
12
roles/service/tasks/additional_socat.yaml
Normal file
12
roles/service/tasks/additional_socat.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
- name: Socat for socket published ports of {{ service_name }}
|
||||
ansible.builtin.include_role:
|
||||
name: socat
|
||||
loop: "{{ _service_additional_container_publish_socket_ports }}"
|
||||
loop_control:
|
||||
loop_var: publish_port
|
||||
vars:
|
||||
socat_service_name: "{{ service_name }}-{{ publish_port.name }}"
|
||||
socat_target_container: "{{ _service_additional_container.name }}"
|
||||
socat_target_http_port: "{{ publish_port.container_port }}"
|
||||
socat_auto_update: "{{ service_auto_update }}"
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user