kolla-ansible/ansible/roles/mongodb/templates/bootstrap_cluster.js.j2
Vladislav Belogrudov 073cfb2a33 Some tasks fail if NIC names differ
During configuration file generation one uses local variable
api_interface that reference remote host. Instead we should
use hostvars to find out correct interface name for each host
mentioned in configuration.

Change-Id: I9f64fdf2cd18bcc0bbf1c4193349186d9a7658bc
Closes-Bug: #1650195
2016-12-15 13:58:30 +00:00

15 lines
400 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]['storage_interface']]['ipv4']['address'] }}:{{ mongodb_port }}"
}{% if not loop.last %},{% endif %}
{% endfor %}
]
}
))