From 8fc8d327b3a8d3b7577263ca88c63e2a011682b2 Mon Sep 17 00:00:00 2001
From: Jeffrey Zhang <zhang.lei.fly@gmail.com>
Date: Wed, 8 Mar 2017 16:38:16 +0800
Subject: [PATCH] Fix mongodb cluster using wrong network interface

MongoDB cluster only uses api_interface.

Change-Id: If24a1c9bd685b268068cb676a28316636af52b78
Closes-Bug: #1626339
---
 ansible/roles/mongodb/templates/bootstrap_cluster.js.j2 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 %}
     ]