user4136080
user4136080

Reputation: 165

Handling multiple node by Chef

Example, I have 1 recipe file, 5 target nodes. How do I apply the recipe file to all the target node? Any commands I need to use or ? I'm not aiming to go into each and every target node to run the chef-client, my aim is to maybe by just single command or using other methods to get this done.

If you know how, do comment and give some reference answer as well.

Thank you.

Upvotes: 0

Views: 1804

Answers (2)

rastasheep
rastasheep

Reputation: 11222

You can run chef-client on multiple nodes via knife ssh command like:

knife ssh "role:app" "sudo chef-client" -x myuser -p 22

More info about knife ssh you can find here.

More info about search syntax you can find here.

Another approach is to have cron job that would run chef-client every N minutes, and then your nodes will be updated when you upload changes to chef server.

Upvotes: 2

StephenKing
StephenKing

Reputation: 37600

You upload the cookbook once to the Chef server, the nodes then pick it up from there.

Here on learnchef.com is the corresponding explanation.

Upvotes: 0

Related Questions