Make socat its own role
This commit is contained in:
@@ -5,17 +5,3 @@
|
||||
state: restarted
|
||||
daemon_reload: true
|
||||
ignore_errors: '{{ ansible_check_mode }}'
|
||||
|
||||
- name: Restart socat socket for {{ service_name }}
|
||||
ansible.builtin.systemd_service:
|
||||
name: "{{ service_name }}-socat.socket"
|
||||
state: restarted
|
||||
daemon_reload: true
|
||||
ignore_errors: '{{ ansible_check_mode }}'
|
||||
|
||||
- name: Restart socat socket for {{ service_name ~ '-oauth2-proxy' }}
|
||||
ansible.builtin.systemd_service:
|
||||
name: "{{ service_name }}-oauth2-proxy-socat.socket"
|
||||
state: restarted
|
||||
daemon_reload: true
|
||||
ignore_errors: '{{ ansible_check_mode }}'
|
||||
|
||||
@@ -47,13 +47,15 @@
|
||||
container_auto_update: "{{ service_auto_update }}"
|
||||
|
||||
- name: Socat for {{ service_name }}
|
||||
ansible.builtin.include_tasks: socat.yaml
|
||||
ansible.builtin.include_role:
|
||||
name: socat
|
||||
when: service_container_http_port > 0
|
||||
vars:
|
||||
socat_service_name: "{{ service_name }}"
|
||||
socat_target_http_port: "{{ service_container_http_port }}"
|
||||
socat_container_ip: >-
|
||||
{{ service_container_ip | ansible.utils.ipmath(3) if _service_static_ip else '' }}
|
||||
socat_auto_update: "{{ service_auto_update }}"
|
||||
|
||||
- name: Reverse proxy for {{ service_name }}
|
||||
ansible.builtin.include_tasks: proxy.yaml
|
||||
|
||||
@@ -30,8 +30,10 @@
|
||||
container_auto_update: "{{ service_auto_update }}"
|
||||
|
||||
- name: Socat for OAuth2 Proxy for {{ service_name }}
|
||||
ansible.builtin.import_tasks: socat.yaml
|
||||
ansible.builtin.import_role:
|
||||
name: socat
|
||||
vars:
|
||||
socat_service_name: "{{ service_name }}-oauth2-proxy"
|
||||
socat_target_http_port: 4180
|
||||
socat_container_ip: ""
|
||||
socat_auto_update: "{{ service_auto_update }}"
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
---
|
||||
- name: Socat socket for {{ socat_service_name }}
|
||||
ansible.builtin.template:
|
||||
src: socat.socket.j2
|
||||
dest: /etc/systemd/system/{{ socat_service_name }}-socat.socket
|
||||
mode: "0644"
|
||||
notify: Restart socat socket for {{ socat_service_name }}
|
||||
|
||||
- name: Socat container for {{ socat_service_name }}
|
||||
ansible.builtin.import_role:
|
||||
name: container
|
||||
vars:
|
||||
container_name: "{{ socat_service_name }}-socat"
|
||||
container_image: "docker.io/alpine/socat:latest"
|
||||
container_command:
|
||||
- "ACCEPT-FD:3,fork"
|
||||
- "TCP:{{ socat_service_name }}:{{ socat_target_http_port }}"
|
||||
container_user: nobody
|
||||
container_networks:
|
||||
- "{{ socat_service_name }}"
|
||||
container_ip: "{{ socat_container_ip }}"
|
||||
container_requires:
|
||||
- "{{ socat_service_name }}-socat.socket"
|
||||
- "{{ socat_service_name }}.service"
|
||||
container_auto_start: false
|
||||
container_auto_update: "{{ service_auto_update }}"
|
||||
@@ -1,6 +0,0 @@
|
||||
# {{ ansible_managed }}
|
||||
[Unit]
|
||||
Description={{ socat_service_name }} socat socket
|
||||
|
||||
[Socket]
|
||||
ListenStream=/run/{{ socat_service_name }}-socat.sock
|
||||
Reference in New Issue
Block a user