Randomly selects a node from the supplied cluster and restarts a service on that host
The included tasks file will perform the following operations...
- Select random host from play_hosts.
- Stop service.
- Wait for interval.
- Start service.
- Wait for Service back up, Port?
- Wait for second defined interval.
The outer playbook controls the execution of these tasks over multiple calls.
- service_name: The service to be stopped & started.
- 1st_interval: The 1st interval after the service has been stopped.
- service_port: The service port that will be checked when the service is restarted.
- wait_for_timeout: How long we will wait for the service port to start responding.
- 2nd_interval: The 2nd wait interval after the service has been restarted and the port responds.
- max_iterations: The maximum number of iterations.
- port_delay: How long to wait before listening for the service port after a restart.
ansible-playbook -l cassandra -i inventory service_restarter.yml