gextra
gextra

Reputation: 8885

how can the chef server know if a node's role was applied and its service is up and running?

If a node's role was defined as, for example, apache2, and assuming the chef-client checks every X seconds interval for changes, how can the chef-server know that the role was successfully applied and that the service defined by apache2 ( httpd ) is up/running ?

The use case for the above is to perform some orchestration, where roles are assigned and then some sort of loop checks to see if the service is completed and running, before proceeding to a next stage assigment.

Upvotes: 1

Views: 610

Answers (1)

Mark O'Connor
Mark O'Connor

Reputation: 77951

Consider enabling the lastrun handler, the code will set a number of node attributes that can be used to determine the state of the last chef client run.

Chef is a declarative language. One must assume that if the recipe states the service should be running and client completes without error, then the service is indeed running.

Another option would be to kick-start run the chef client using the knife command

knife ssh "role:webserver" "sudo chef-client"

This will ensure that all your nodes are properly converged.

Upvotes: 2

Related Questions