Hands on with ansible: Elastic Search

4 views 11:41 pm 0 Comments March 18, 2019

Requirement:

Update log4j2.properties on all elastic search servers, restart them and check if logs are being rolled and purged over or not.

Use Case 1:

  1. Take backup of existing log4j2.properties if exists
  2. Update log4j2.properties of all the elastic search data and master nodes
  3. Restart elastic search server

playbook : log4j-update.yml

[java]command:ansible-playbook -i els-inventory.ini log4j-update.yml [/java]

Use Case 2:

  1. Check whether elastic search service is up and running on all nodes or not,
  2. If an instance got terminated and ECS launced a new instance get the IP of that node

playbook :service-status.yml

[java] command:ansible-playbook -i els-inventory.ini service-status.yml [/java]

Use Case 3:

  1. Check whether logs are being rolled and purged over correctly

playbook log-rotation.yml

[java] command:ansible-playbook -i els-inventory.ini log-rotation.yml [/java]

Note: Use case 3 will give you correct result only on next day.

Code is available here at github https://github.com/santoshjoshi/ansible-utilities

Leave a Reply

Your email address will not be published. Required fields are marked *