From f7bfce20ada638b80bf06d0a8134ca9e01dea273 Mon Sep 17 00:00:00 2001
From: Xing Zhang <angeiv.zhang@gmail.com>
Date: Sun, 16 Jun 2019 18:32:24 +0800
Subject: [PATCH] Fix mongo command for supporting other port

If we change mongodb_port, the command for bootstraping mongodb
should not connect to the default mongodb port 27017.

Change-Id: I330999be577d6416df162ea33fa1f7a19df56029
---
 ansible/roles/mongodb/tasks/bootstrap_cluster.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ansible/roles/mongodb/tasks/bootstrap_cluster.yml b/ansible/roles/mongodb/tasks/bootstrap_cluster.yml
index 487edfc522..c8633d4a25 100644
--- a/ansible/roles/mongodb/tasks/bootstrap_cluster.yml
+++ b/ansible/roles/mongodb/tasks/bootstrap_cluster.yml
@@ -5,7 +5,7 @@
 
 - name: Bootstrapping the mongodb replication set
   become: true
-  command: "docker exec -t mongodb mongo {{ api_interface_address }} --quiet --eval '{{ lookup('file','/tmp/mongodb_bootstrap_replication_set.js') }}'"
+  command: "docker exec -t mongodb mongo --host {{ api_interface_address }} --port {{ mongodb_port }} --quiet --eval '{{ lookup('file','/tmp/mongodb_bootstrap_replication_set.js') }}'"
   register: bootstrap_mongodb_cluster
   failed_when: (bootstrap_mongodb_cluster.stdout|from_json).ok != 1
   delegate_to: "{{ groups['mongodb'][0] }}"