kolla-ansible/ansible/roles/mongodb/templates/bootstrap_cluster.js.j2
Jeffrey Zhang 8fc8d327b3 Fix mongodb cluster using wrong network interface
MongoDB cluster only uses api_interface.

Change-Id: If24a1c9bd685b268068cb676a28316636af52b78
Closes-Bug: #1626339
2017-03-08 16:40:31 +08:00

15 lines
396 B
Django/Jinja

printjson(rs.initiate(
{
"_id" : "{{ mongodb_replication_set_name }}",
"version" : 1,
"members" : [
{% for host in groups["mongodb"] %}
{
"_id" : {{ loop.index }},
"host" : "{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ mongodb_port }}"
}{% if not loop.last %},{% endif %}
{% endfor %}
]
}
))