Created
October 30, 2017 22:33
-
-
Save bwhaley/61e1ddb33307be05e9609c053a8df9ce to your computer and use it in GitHub Desktop.
Ansible playbook for graceful rolling restart of the nodes in a cassandra cluster
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
- hosts: "*" | |
become: True | |
serial: 1 | |
tasks: | |
- name: Initiate graceful shutdown | |
shell: "nodetool {{item}} && sleep 5" | |
with_items: | |
- disablethrift | |
- disablebinary | |
- disablegossip | |
- flush | |
- drain | |
- name: Restart cassandra | |
service: | |
name: cassandra | |
state: restarted | |
- name: Wait for restart to complete | |
wait_for: | |
host: "{{ansible_default_ipv4.address}}" | |
port: 9160 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment