Last active
May 7, 2017 12:13
-
-
Save ei-grad/5f6730170dffa8eaca1447f7d74f2d8d to your computer and use it in GitHub Desktop.
Ansible playbook for rolling elasticsearch cluster upgrade
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - name: upgrade elasticsearch | |
| hosts: elastic | |
| serial: 1 | |
| tasks: | |
| - name: stop elasticsearch | |
| service: name=elasticsearch state=stopped | |
| - name: remove elasticsearch plugins | |
| command: /usr/share/elasticsearch/bin/elasticsearch-plugin remove x-pack | |
| - name: upgrade elasticsearch | |
| apt: name=elasticsearch state=latest | |
| - name: install elasticsearch plugins | |
| command: /usr/share/elasticsearch/bin/elasticsearch-plugin install -b x-pack | |
| - name: restart elasticsearch | |
| service: name=elasticsearch state=restarted | |
| - name: wait for green cluster state | |
| shell: "while curl -s {{elasticsearch_url}}/_cat/health | grep -v green; do sleep 1; done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment