diff --git a/ansible/roles/mongodb/templates/bootstrap_cluster.js.j2 b/ansible/roles/mongodb/templates/bootstrap_cluster.js.j2 index d52b66fdb0..fcf6c51afb 100644 --- a/ansible/roles/mongodb/templates/bootstrap_cluster.js.j2 +++ b/ansible/roles/mongodb/templates/bootstrap_cluster.js.j2 @@ -6,7 +6,7 @@ printjson(rs.initiate( {% for host in groups["mongodb"] %} { "_id" : {{ loop.index }}, - "host" : "{{ hostvars[host]['ansible_' + hostvars[host]['storage_interface']]['ipv4']['address'] }}:{{ mongodb_port }}" + "host" : "{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ mongodb_port }}" }{% if not loop.last %},{% endif %} {% endfor %} ]