bugfix: mongodb's priority should consistent with keepalived for failover 51/6651/1
authorcarey.xu <carey.xuhan@huawei.com>
Thu, 14 Jan 2016 02:57:37 +0000 (10:57 +0800)
committerJustin chi <chigang@huawei.com>
Thu, 14 Jan 2016 09:15:45 +0000 (09:15 +0000)
JIRA: COMPASS-260

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

deploy/adapters/ansible/roles/database/tasks/mongodb_config.yml
deploy/adapters/ansible/roles/database/templates/replica.js

index e3a68c5..3e7fe5f 100755 (executable)
@@ -30,7 +30,7 @@
 
 - name: create mongodb user and db
   mongodb_user:
-    login_host: "{{ internal_ip }}"
+    login_host: "{{ internal_vip.ip }}"
     database: ceilometer
     name: ceilometer
     password: "{{ CEILOMETER_DBPASS }}"
@@ -39,7 +39,7 @@
 
 - name: grant user privilege
   mongodb_user:
-    login_host: "{{ internal_ip }}"
+    login_host: "{{ internal_vip.ip }}"
     database: ceilometer
     name: ceilometer
     password: "{{ CEILOMETER_DBPASS }}"
index dd5fc57..7e7072f 100644 (file)
@@ -1,8 +1,8 @@
 config = { _id:"compass", members:[
-{% for host in haproxy_hosts.values() %}
+{% for hostname, host in haproxy_hosts.items() %}
 {% set pair = '%s:27017' % host %}
-    {_id:{{ loop.index0 }},host:"{{ pair }}",priority:{{ host_index[inventory_hostname] + 1 }}},
-{% endfor %}
-]
+    {_id:{{ loop.index0 }},host:"{{ pair }}",priority:{{ host_index[hostname] + 1 }}},
+    {% endfor %}
+    ]
 };
 rs.initiate(config);