Skip to content

Instantly share code, notes, and snippets.

@bwhaley
Created October 30, 2017 22:33
Show Gist options
  • Save bwhaley/61e1ddb33307be05e9609c053a8df9ce to your computer and use it in GitHub Desktop.
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
- 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