Skip to content

Commit 9733e01

Browse files
committed
fix value does not exist error
1 parent 2294132 commit 9733e01

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

roles/mongo/tasks/cluster.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,15 @@
4141
- name: Set fact for arbiter index number
4242
ansible.builtin.set_fact:
4343
arbiter_index: "{{ hostid }}"
44-
when: hostvars[item].mongo_arbiter
44+
when: hostvars[item].mongo_arbiter is defined and hostvars[item].mongo_arbiter
4545
loop: "{{ mongo_servers }}"
4646
loop_control:
4747
index_var: hostid
4848

49+
- name: Debug host_id
50+
ansible.builtin.debug:
51+
msg: "{{ hostid }}"
52+
4953
- name: Initial cluster initialisation
5054
community.mongodb.mongodb_replicaset:
5155
login_host: localhost

0 commit comments

Comments
 (0)