Several machines with the same role - how to restart service node by node?


#1

Hi Everyone :slight_smile:

I have a set of frontend machines with a loadbalancer on top of them. There
is a need to restart a service on all of them once a new delivery package
comes. I now how to do this but I do not know how to force chef to perform
the restart on one node at a time FOR SURE. Loadbalancer can be asked for
the status of all frontends and a decision which frontend should be made
based on returned info but there is a possibility for race conditions in
this case.

Have you done something similar? What do you propose?

BR,
Rafal.


#2

Look at Chef push jobs https://docs.chef.io/push_jobs.html. You can setup an algorithm to search all your front end machines, then iterate through your search results to

front_end_machines.each do |fe|
knife job start “cookbook_to_restart_machine” fe
end

Chris

From: Rafał Radecki [mailto:radecki.rafal@gmail.com]
Sent: Wednesday, February 11, 2015 4:55 AM
To: chef@lists.opscode.com
Subject: [chef] Several machines with the same role - how to restart service node by node?

Hi Everyone :slight_smile:

I have a set of frontend machines with a loadbalancer on top of them. There is a need to restart a service on all of them once a new delivery package comes. I now how to do this but I do not know how to force chef to perform the restart on one node at a time FOR SURE. Loadbalancer can be asked for the status of all frontends and a decision which frontend should be made based on returned info but there is a possibility for race conditions in this case.

Have you done something similar? What do you propose?

BR,
Rafal.