Running the same command on many machines at once

A simple problem with so many self-scripted solutions is logging in to multiple boxes in parallel, executing the same command on every box at once. No matter whether you want to check the status of a certain service or look at some critical system data on all boxes, being able to log in to many servers in parallel can save you a lot of time and hassle (imagine forgetting one of your seven web servers when disabling the basic authentication for your website).

How to do it...

Let's try to execute a few simple commands on multiple servers in parallel:

  1. Retrieve the status of the nginx processes from all your web servers (assuming you have at least one host up and running, which has the role web_server ...

Get Chef Infrastructure Automation Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.