Skip to content

Commit

Permalink
Merge pull request #2460 from ProgrammeVitam/cp80_bug_14312_fix_mongo…
Browse files Browse the repository at this point in the history
…_nodes_fact

CP V8.0 - Bug #14312: Reset mongo_nodes facts.
  • Loading branch information
GiooDev authored Feb 18, 2025
2 parents 030ac01 + f754542 commit b4ee2e3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
8 changes: 6 additions & 2 deletions deployment/roles/mongo/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,15 @@
- import_tasks: check_auth.yml

# Create the local shard admin user
- name: Unset mongo_nodes fact
set_fact:
mongo_nodes: []

- name: Compute list of mongo_nodes
set_fact:
mongo_nodes: "{{ mongo_nodes | default([]) + [ hostvars[item]['ip_service'] + ':' + mongodb.mongod_port | string ] }}"
mongo_nodes: "{{ mongo_nodes + [ hostvars[item]['ip_service'] + ':' + mongodb.mongod_port | string ] }}"
loop: "{{ groups['hosts_vitamui_mongod'] }}"
when: hostvars[item]['mongo_arbiter'] | default(false) | bool == false
when: not hostvars[item]['mongo_arbiter'] | default(false) | bool

- name: Copy the script which create the local users
template:
Expand Down
8 changes: 6 additions & 2 deletions deployment/roles/mongo_init/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@
- fail: msg="Variable '{{ mongod_source_template_dir }}' is not defined"
when: mongod_source_template_dir is undefined

- name: Unset mongo_nodes fact
set_fact:
mongo_nodes: []

- name: Compute list of mongo nodes
set_fact:
mongo_nodes: "{{ mongo_nodes | default([]) + [ hostvars[item]['ip_service'] + ':'+ mongodb.mongod_port | string ] }}"
mongo_nodes: "{{ mongo_nodes + [ hostvars[item]['ip_service'] + ':' + mongodb.mongod_port | string ] }}"
loop: "{{ groups['hosts_vitamui_mongod'] }}"
when: hostvars[item]['mongo_arbiter'] | default(false) | bool == false
when: not hostvars[item]['mongo_arbiter'] | default(false) | bool

- name: Set Mongo URI
set_fact:
Expand Down
8 changes: 6 additions & 2 deletions deployment/roles/reinit_security_certificates/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
---

- name: Unset mongo_nodes fact
set_fact:
mongo_nodes: []

- name: Compute list of mongo nodes
set_fact:
mongo_nodes: "{{ mongo_nodes | default([]) + [ hostvars[item]['ip_service'] + ':'+ mongodb.mongod_port | string ] }}"
mongo_nodes: "{{ mongo_nodes + [ hostvars[item]['ip_service'] + ':' + mongodb.mongod_port | string ] }}"
loop: "{{ groups['hosts_vitamui_mongod'] }}"
when: hostvars[item]['mongo_arbiter'] | default(false) | bool == false
when: not hostvars[item]['mongo_arbiter'] | default(false) | bool

- name: Set Mongo URI and credentials
set_fact:
Expand Down

0 comments on commit b4ee2e3

Please sign in to comment.