service: Set static ips for other containers too
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
container_mounts: "{{ _service_additional_container_mounts }}"
|
container_mounts: "{{ _service_additional_container_mounts }}"
|
||||||
container_publish_ports: "{{ _service_additional_container.publish_ports | default([]) }}"
|
container_publish_ports: "{{ _service_additional_container.publish_ports | default([]) }}"
|
||||||
container_networks: "{{ _service_container_networks }}"
|
container_networks: "{{ _service_container_networks }}"
|
||||||
|
container_ip: "{{ _service_additional_container_ip }}"
|
||||||
container_secrets: "{{ _service_additional_container.secrets | default(_service_container_secrets) }}"
|
container_secrets: "{{ _service_additional_container.secrets | default(_service_container_secrets) }}"
|
||||||
container_env: "{{ _service_additional_container.env | default(service_container_env) }}"
|
container_env: "{{ _service_additional_container.env | default(service_container_env) }}"
|
||||||
container_requires: "{{ _service_container_requires }}"
|
container_requires: "{{ _service_container_requires }}"
|
||||||
@@ -19,3 +20,4 @@
|
|||||||
loop: "{{ _service_additional_containers }}"
|
loop: "{{ _service_additional_containers }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: _service_additional_container
|
loop_var: _service_additional_container
|
||||||
|
index_var: _service_additional_container_index
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
source: "{{ _service_database_name }}"
|
source: "{{ _service_database_name }}"
|
||||||
destination: /var/lib/postgresql/data
|
destination: /var/lib/postgresql/data
|
||||||
container_networks: "{{ _service_database_networks }}"
|
container_networks: "{{ _service_database_networks }}"
|
||||||
|
container_ip: >-
|
||||||
|
{{ service_container_ip | ansible.utils.ipmath(1) if _service_static_ip else '' }}
|
||||||
container_secrets:
|
container_secrets:
|
||||||
- name: "{{ _service_database_name }}"
|
- name: "{{ _service_database_name }}"
|
||||||
target: "{{ service_database_type }}"
|
target: "{{ service_database_type }}"
|
||||||
|
|||||||
@@ -47,6 +47,8 @@
|
|||||||
vars:
|
vars:
|
||||||
socat_service_name: "{{ service_name }}"
|
socat_service_name: "{{ service_name }}"
|
||||||
socat_target_http_port: "{{ service_container_http_port }}"
|
socat_target_http_port: "{{ service_container_http_port }}"
|
||||||
|
socat_container_ip: >-
|
||||||
|
{{ service_container_ip | ansible.utils.ipmath(3) if _service_static_ip else '' }}
|
||||||
|
|
||||||
- name: Reverse proxy for {{ service_name }}
|
- name: Reverse proxy for {{ service_name }}
|
||||||
ansible.builtin.include_tasks: proxy.yaml
|
ansible.builtin.include_tasks: proxy.yaml
|
||||||
|
|||||||
@@ -34,3 +34,4 @@
|
|||||||
vars:
|
vars:
|
||||||
socat_service_name: "{{ service_name }}-oauth2-proxy"
|
socat_service_name: "{{ service_name }}-oauth2-proxy"
|
||||||
socat_target_http_port: 4180
|
socat_target_http_port: 4180
|
||||||
|
socat_container_ip: ""
|
||||||
|
|||||||
@@ -7,4 +7,6 @@
|
|||||||
container_image: docker.io/valkey/valkey:alpine
|
container_image: docker.io/valkey/valkey:alpine
|
||||||
container_networks:
|
container_networks:
|
||||||
- "{{ service_name }}"
|
- "{{ service_name }}"
|
||||||
|
container_ip: >-
|
||||||
|
{{ service_container_ip | ansible.utils.ipmath(2) if _service_static_ip else '' }}
|
||||||
container_auto_update: "{{ service_auto_update }}"
|
container_auto_update: "{{ service_auto_update }}"
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
container_user: nobody
|
container_user: nobody
|
||||||
container_networks:
|
container_networks:
|
||||||
- "{{ socat_service_name }}"
|
- "{{ socat_service_name }}"
|
||||||
|
container_ip: "{{ socat_container_ip }}"
|
||||||
container_requires:
|
container_requires:
|
||||||
- "{{ socat_service_name }}-socat.socket"
|
- "{{ socat_service_name }}-socat.socket"
|
||||||
- "{{ socat_service_name }}.service"
|
- "{{ socat_service_name }}.service"
|
||||||
|
|||||||
@@ -11,6 +11,13 @@ _service_additional_containers: >-
|
|||||||
| map('combine')
|
| map('combine')
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
_service_additional_container_ip: >-
|
||||||
|
{{
|
||||||
|
service_container_ip |
|
||||||
|
ansible.utils.ipmath(20 + _service_additional_container_index)
|
||||||
|
if _service_static_ip else ''
|
||||||
|
}}
|
||||||
|
|
||||||
|
|
||||||
_service_additional_volume_mounts: "{{ _service_additional_container.mounts | selectattr('type', '==', 'volume') }}"
|
_service_additional_volume_mounts: "{{ _service_additional_container.mounts | selectattr('type', '==', 'volume') }}"
|
||||||
_service_additional_template_mounts: "{{ _service_additional_container.mounts | selectattr('type', '==', 'template') }}"
|
_service_additional_template_mounts: "{{ _service_additional_container.mounts | selectattr('type', '==', 'template') }}"
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
_service_container_networks: "{{ [service_name] + service_container_additional_networks }}"
|
_service_container_networks: "{{ [service_name] + service_container_additional_networks }}"
|
||||||
|
_service_static_ip: "{{ service_container_ip | length > 0 }}"
|
||||||
|
|
||||||
_service_container_requires: >-
|
_service_container_requires: >-
|
||||||
{{
|
{{
|
||||||
|
|||||||
Reference in New Issue
Block a user