Bertrand Lallau afdd11b9a2 Generalize api_interface_address variable usage
Useful api_interface_address variable has been define here:
https://github.com/openstack/kolla-ansible/blob/master/ansible/group_vars/all.yml#L57
In order to simplify codebase we must use it as much as possible.

Change-Id: I18fec19bf69e05a22a4142a9cd1165eccd022455
2017-05-23 08:35:15 +00:00

20 lines
1.2 KiB
Django/Jinja

{% set num_nodes = groups['elasticsearch'] | length %}
{% set minimum_master_nodes = (num_nodes / 2 + 1) | round(0, 'floor') | int if num_nodes > 2 else 1 %}
{% set recover_after_nodes = (num_nodes * 2 / 3) | round(0, 'floor') | int if num_nodes > 1 else 1 %}
node.name: "{{ api_interface_address }}"
network.host: {% if orchestration_engine == 'KUBERNETES' %}_eth0:ipv4_{% else %}"{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}"{% endif %}
cluster.name: "{% if orchestration_engine == 'KUBERNETES' %}0.0.0.0{% else %}{{ elasticsearch_cluster_name }}{% endif %}"
node.master: true
node.data: true
discovery.zen.ping.unicast.hosts: [{% if orchestration_engine == 'KUBERNETES' %}"0.0.0.0"{% else %}{% for host in groups['elasticsearch'] %}"{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}"{% if not loop.last %},{% endif %}{% endfor %}{% endif %}]
discovery.zen.minimum_master_nodes: {{ minimum_master_nodes }}
gateway.expected_nodes: {{ num_nodes }}
gateway.recover_after_time: "5m"
gateway.recover_after_nodes: {{ recover_after_nodes }}
path.conf: "/etc/elasticsearch"
path.data: "/var/lib/elasticsearch/data"
path.logs: "/var/log/kolla/elasticsearch"
path.scripts: "/etc/elasticsearch/scripts"