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:
- Take backup of existing log4j2.properties if exists
- Update log4j2.properties of all the elastic search data and master nodes
- Restart elastic search server
playbook : log4j-update.yml
command:ansible-playbook -i els-inventory.ini log4j-update.yml
Use Case 2:
- Check whether elastic search service is up and running on all nodes or not,
- If an instance got terminated and ECS launced a new instance get the IP of that node
playbook :service-status.yml
command:ansible-playbook -i els-inventory.ini service-status.yml 
Use Case 3:
- Check whether logs are being rolled and purged over correctly
playbook log-rotation.yml
command:ansible-playbook -i els-inventory.ini log-rotation.yml 
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