Hi,
I am trying to configure Elasticsearch cluster over Ansible using official Elastic Ansible role elastic.elasticsearch. I set up Ansible tower and Dynamic Inventory for my AWS instances. I tagged my instances and have them all grouped in tag_Group_Elasticsearch. Here is the Ansible code:
hosts: tag_Group_Elasticsearch
roles:
- role: elastic.elasticsearch
vars:
es_heap_size: "2g"
es_config:
network.host: 0.0.0.0
cluster.name: "prod-cluster"
cluster.initial_master_nodes: "tag_Group_Elasticsearch"
discovery.seed_hosts: "tag_Group_Elasticsearch"
http.port: 9200
node.master: true
bootstrap.memory_lock: false
es_plugins:
- plugin: ingest-attachment
So when I want to use the group in the role it works well when it come to hosts part of the play. It resolves well and apply to all hosts in the group. But when I want to use it in es_config variable it doesn't resolve to hosts names it just pass it as a string and therefore, elasticsearch cluster fails.
This is what I get in elasticsearch.yml on the cluster members:
cluster.initial_master_nodes: tag_Group_Elasticsearch
discovery.seed_hosts: tag_Group_Elasticsearch
What I need to have here is:
cluster.initial_master_nodes: "192.168.x.x, 192.168.x.x, 192.168.x.x "
discovery.seed_hosts: "192.168.x.x, 192.168.x.x, 192.168.x.x"
I can't add hostnames in cluster.initial_master_nodes and discovery.seed_hosts manually as my Elasticsearch cluster is built over AWS autoscaling group and my hosts are dynamic...
Cheers,
Dragan