diff --git a/deployment/roles/vitamui/tasks/main.yml b/deployment/roles/vitamui/tasks/main.yml index 996cba36e05..7f3ddc52226 100644 --- a/deployment/roles/vitamui/tasks/main.yml +++ b/deployment/roles/vitamui/tasks/main.yml @@ -76,6 +76,16 @@ - restart service when: install_mode != "container" +- name: Compute list of mongo nodes + set_fact: + mongo_nodes: "{{ mongo_nodes | default([]) + [ hostvars[item]['ip_service'] + ':' + mongodb.mongod_port | string ] }}" + loop: "{{ groups['hosts_vitamui_mongod'] }}" + when: hostvars[item]['mongo_arbiter'] | default(false) | bool == false + +- name: Set Mongo URI + set_fact: + mongod_uri: "{{ mongo_nodes | join(',') }}" + - name: Deploy common configuration files in sysconfig subdir template: src: "{{ item }}.j2" diff --git a/deployment/roles/vitamui/templates/archive-search-internal/application.yml.j2 b/deployment/roles/vitamui/templates/archive-search-internal/application.yml.j2 index 8ac28b2c30b..6961c517e75 100644 --- a/deployment/roles/vitamui/templates/archive-search-internal/application.yml.j2 +++ b/deployment/roles/vitamui/templates/archive-search-internal/application.yml.j2 @@ -12,7 +12,7 @@ spring: instanceId: {{ vitamui_struct.vitamui_component }}-${server.port}-${spring.cloud.client.hostname} data: mongodb: - uri: mongodb://{{ mongodb.archivesearch.user }}:{{ mongodb.archivesearch.password }}@{{ mongodb.host }}:{{ mongodb.mongod_port }}/{{ mongodb.archivesearch.db }}?replicaSet={{ mongod_replicaset_name }}&connectTimeoutMS={{ mongod_client_connect_timeout_ms }} + uri: mongodb://{{ mongodb.archivesearch.user }}:{{ mongodb.archivesearch.password }}@{{ mongod_uri }}/{{ mongodb.archivesearch.db }}?replicaSet={{ mongod_replicaset_name }}&connectTimeoutMS={{ mongod_client_connect_timeout_ms }} server-identity: identityName: {{ vitamui_site_name if groups['hosts_vitamui_consul_server'] | default([]) | length > 0 else vitam_site_name }} diff --git a/deployment/roles/vitamui/templates/cas-server/application.yml.j2 b/deployment/roles/vitamui/templates/cas-server/application.yml.j2 index 18a0089c9ea..889928a6b22 100644 --- a/deployment/roles/vitamui/templates/cas-server/application.yml.j2 +++ b/deployment/roles/vitamui/templates/cas-server/application.yml.j2 @@ -91,7 +91,7 @@ cas.server.prefix: {{ url_prefix }}/cas {% endif %} login.url: ${cas.server.prefix}/login -cas.service-registry.mongo.client-uri: "mongodb://{{ mongodb.cas.user }}:{{ mongodb.cas.password }}@{{ mongodb.host }}:{{ mongodb.mongod_port | default(27017) }}/{{ mongodb.cas.db }}?replicaSet={{ mongod_replicaset_name }}&connectTimeoutMS={{ mongod_client_connect_timeout_ms }}" +cas.service-registry.mongo.client-uri: "mongodb://{{ mongodb.cas.user }}:{{ mongodb.cas.password }}@{{ mongod_uri }}/{{ mongodb.cas.db }}?replicaSet={{ mongod_replicaset_name }}&connectTimeoutMS={{ mongod_client_connect_timeout_ms }}" cas.service-registry.mongo.collection: services cas.service-registry.mongo.user-id: {{ mongodb.cas.user }} cas.service-registry.mongo.password: {{ mongodb.cas.password }} diff --git a/deployment/roles/vitamui/templates/collect-internal/application.yml.j2 b/deployment/roles/vitamui/templates/collect-internal/application.yml.j2 index 2440b864fae..72bb77cd427 100644 --- a/deployment/roles/vitamui/templates/collect-internal/application.yml.j2 +++ b/deployment/roles/vitamui/templates/collect-internal/application.yml.j2 @@ -12,7 +12,7 @@ spring: instanceId: {{ vitamui_struct.vitamui_component }}-${server.port}-${spring.cloud.client.hostname} data: mongodb: - uri: mongodb://{{ mongodb.archivesearch.user }}:{{ mongodb.archivesearch.password }}@{{ mongodb.host }}:{{ mongodb.mongod_port }}/{{ mongodb.archivesearch.db }}?replicaSet={{ mongod_replicaset_name }}&connectTimeoutMS={{ mongod_client_connect_timeout_ms }} + uri: mongodb://{{ mongodb.archivesearch.user }}:{{ mongodb.archivesearch.password }}@{{ mongod_uri }}/{{ mongodb.archivesearch.db }}?replicaSet={{ mongod_replicaset_name }}&connectTimeoutMS={{ mongod_client_connect_timeout_ms }} servlet: multipart: max-file-size: -1 diff --git a/deployment/roles/vitamui/templates/iam-internal/application.yml.j2 b/deployment/roles/vitamui/templates/iam-internal/application.yml.j2 index a1844d81061..00bd8da1fed 100644 --- a/deployment/roles/vitamui/templates/iam-internal/application.yml.j2 +++ b/deployment/roles/vitamui/templates/iam-internal/application.yml.j2 @@ -12,7 +12,7 @@ spring: instanceId: {{ vitamui_struct.vitamui_component }}-${server.port}-${spring.cloud.client.hostname} data: mongodb: - uri: "mongodb://{{ mongodb.iam.user }}:{{ mongodb.iam.password }}@{{ mongodb.host }}:{{ mongodb.mongod_port }}/{{ mongodb.iam.db }}?replicaSet={{ mongod_replicaset_name }}&connectTimeoutMS={{ mongod_client_connect_timeout_ms }}" + uri: "mongodb://{{ mongodb.iam.user }}:{{ mongodb.iam.password }}@{{ mongod_uri }}/{{ mongodb.iam.db }}?replicaSet={{ mongod_replicaset_name }}&connectTimeoutMS={{ mongod_client_connect_timeout_ms }}" logging: config: {{ vitamui_folder_conf }}/logback.xml diff --git a/deployment/roles/vitamui/templates/ingest-internal/application.yml.j2 b/deployment/roles/vitamui/templates/ingest-internal/application.yml.j2 index 1a1dcfbafc5..68eb168bb96 100644 --- a/deployment/roles/vitamui/templates/ingest-internal/application.yml.j2 +++ b/deployment/roles/vitamui/templates/ingest-internal/application.yml.j2 @@ -12,7 +12,7 @@ spring: instanceId: {{ vitamui_struct.vitamui_component }}-${server.port}-${spring.cloud.client.hostname} data: mongodb: - uri: "mongodb://{{ mongodb.iam.user }}:{{ mongodb.iam.password }}@{{ mongodb.host }}:{{ mongodb.mongod_port }}/{{ mongodb.iam.db }}?replicaSet={{ mongod_replicaset_name }}&connectTimeoutMS={{ mongod_client_connect_timeout_ms }}" + uri: "mongodb://{{ mongodb.iam.user }}:{{ mongodb.iam.password }}@{{ mongod_uri }}/{{ mongodb.iam.db }}?replicaSet={{ mongod_replicaset_name }}&connectTimeoutMS={{ mongod_client_connect_timeout_ms }}" server-identity: identityName: {{ vitamui_site_name if groups['hosts_vitamui_consul_server'] | default([]) | length > 0 else vitam_site_name }} diff --git a/deployment/roles/vitamui/templates/security-internal/application.yml.j2 b/deployment/roles/vitamui/templates/security-internal/application.yml.j2 index 99462047835..3579782b1b2 100644 --- a/deployment/roles/vitamui/templates/security-internal/application.yml.j2 +++ b/deployment/roles/vitamui/templates/security-internal/application.yml.j2 @@ -12,7 +12,7 @@ spring: instanceId: {{ vitamui_struct.vitamui_component }}-${server.port}-${spring.cloud.client.hostname} data: mongodb: - uri: "mongodb://{{ mongodb.security.user }}:{{ mongodb.security.password }}@{{ mongodb.host }}:{{ mongodb.mongod_port }}/{{ mongodb.security.db }}?replicaSet={{ mongod_replicaset_name }}&connectTimeoutMS={{ mongod_client_connect_timeout_ms }}" + uri: "mongodb://{{ mongodb.security.user }}:{{ mongodb.security.password }}@{{ mongod_uri }}/{{ mongodb.security.db }}?replicaSet={{ mongod_replicaset_name }}&connectTimeoutMS={{ mongod_client_connect_timeout_ms }}" server-identity: identityName: {{ vitamui_site_name if groups['hosts_vitamui_consul_server'] | default([]) | length > 0 else vitam_site_name }}