An Ansible role to Manage your Elasticsearch Clusters

Fred de Villamil
Fred Thoughts
Published in
2 min readOct 29, 2017

--

The Synthesio Team Coffee (aka the infrastructure team) I'm a proud member of has released a set of Ansible tasks to help you manage an Elasticsearch cluster. The role is published under the MIT License and PRs are welcome if you want to add more tasks.

We have gathered the tasks we perform the most on our various clusters, first as scripts, then as an Ansible role. These tasks are meant to be ran from Jenkins so we can track an history of who did what and when.

This role overlaps with a few things Elastic Curator can do for a reason. We would run Curato from Ansible — to get the clusters specific vars — from Jenkins anyway so we decided to go Ansible all the way.

So far, available tasks are:

  • Create a new index.
  • Optimize a whole cluster, starting with the indices having the greatest number of deleted documents.
  • Optimize a single index.
  • Enable / disable rack awareness on a index / the whole cluster.
  • Perform a rolling restart on a cluster.
  • Perform routing allocation operations, for example to force an index to be or not to be on a host / rack / zone…
  • Update an index / cluster refresh time (useful for bulk indexing).
  • Update an index number of replicas.

All you have to do is clone the repository, and RTFM.

git clone https://github.com/synthesio/infra-ansible-es-tools.git

If you found this article helpful please tap or click “👏”, or follow me on Twitter.

--

--

I can perform under pressure, but not Bohemian Rhapsody. CTO at Data Impact by NielsenIQ. Ex VP @Ledger & @Aircall.