bugfix: mongodb's priority should consistent with keepalived for failover 69/6369/3
authorcarey.xu <carey.xuhan@huawei.com>
Mon, 11 Jan 2016 07:47:14 +0000 (15:47 +0800)
committerJustin chi <chigang@huawei.com>
Thu, 14 Jan 2016 06:11:04 +0000 (06:11 +0000)
JIRA: COMPASS-260

Change-Id: I29e6e21e514e6dab5643e5558c81b851a4442e54
Signed-off-by: carey.xu <carey.xuhan@huawei.com>
(cherry picked from commit da39c5ca863f133f6bbf978dce10b9d21b6b5399)

deploy/adapters/ansible/roles/database/templates/replica.js

index d19db50..dd5fc57 100644 (file)
@@ -1,7 +1,7 @@
 config = { _id:"compass", members:[
 {% for host in haproxy_hosts.values() %}
 {% set pair = '%s:27017' % host %}
-    {_id:{{ loop.index0 }},host:"{{ pair }}",priority:{{ haproxy_hosts|length - loop.index0 }}},
+    {_id:{{ loop.index0 }},host:"{{ pair }}",priority:{{ host_index[inventory_hostname] + 1 }}},
 {% endfor %}
 ]
 };