diff --git a/roles/docker-compose/templates/networks.yml.j2 b/roles/docker-compose/templates/networks.yml.j2 index 8861a9e5..975494b0 100644 --- a/roles/docker-compose/templates/networks.yml.j2 +++ b/roles/docker-compose/templates/networks.yml.j2 @@ -1,5 +1,6 @@ {# This template needs to be included in docker-compose.yml #} networks: +{# Central RDMS-Database Network #} {% if (applications | get_app_conf(application_id, 'features.central_database', False) and database_type is defined) or application_id in ['svc-db-mariadb','svc-db-postgres'] @@ -7,6 +8,7 @@ networks: {{ applications | get_app_conf('svc-db-' ~ database_type, 'docker.network') }}: external: true {% endif %} +{# Central LDAP Network #} {% if applications | get_app_conf(application_id, 'features.ldap', False) and applications | get_app_conf('svc-db-openldap', 'network.docker', False) @@ -14,7 +16,13 @@ networks: {{ applications | get_app_conf('svc-db-openldap', 'docker.network') }}: external: true {% endif %} -{% if not application_id.startswith('svc-db-') %} +{# Central AI Network #} +{% if applications | get_app_conf(application_id, 'features.local_ai', False) %} + {{ applications | get_app_conf('svc-ai-ollama', 'docker.network') }}: + external: true +{% endif %} +{# Default Network #} +{% if not application_id.startswith('svc-db-') and not application_id.startswith('svc-ai-') %} default: {% if application_id in networks.local and diff --git a/roles/svc-ai-ollama/tasks/01_core.yml b/roles/svc-ai-ollama/tasks/01_core.yml index f018cb44..58163f3d 100644 --- a/roles/svc-ai-ollama/tasks/01_core.yml +++ b/roles/svc-ai-ollama/tasks/01_core.yml @@ -1,3 +1,10 @@ +- name: create docker network for Ollama, so that other applications can access it + community.docker.docker_network: + name: "{{ OLLAMA_NETWORK }}" + state: present + ipam_config: + - subnet: "{{ networks.local[application_id].subnet }}" + - name: Include dependency 'sys-svc-docker' include_role: name: sys-svc-docker diff --git a/roles/svc-ai-ollama/vars/main.yml b/roles/svc-ai-ollama/vars/main.yml index 67d3388f..3fb2fb6c 100644 --- a/roles/svc-ai-ollama/vars/main.yml +++ b/roles/svc-ai-ollama/vars/main.yml @@ -11,3 +11,4 @@ OLLAMA_IMAGE: "{{ applications | get_app_conf(application_id, OLLAMA_CONTAINER: "{{ applications | get_app_conf(application_id, 'docker.services.ollama.name') }}" OLLAMA_PORT: "{{ applications | get_app_conf(application_id, 'docker.services.ollama.port') }}" OLLAMA_VOLUME: "{{ applications | get_app_conf(application_id, 'docker.volumes.models') }}" +OLLAMA_NETWORK: "{{ applications | get_app_conf(application_id, 'docker.network') }}"