saltstack/salt — Issue #804: Run command on X% of nodes at a time
Author: SEJeff
Created: 2012-03-01 16:46:06+00:00
State: open

Use case:
Joe Dirt sysadmin wants to update the app and restart the webserver on 100 app servers. They are behind a load balancer so the actual users won't notice anything so long as 80% of the app servers are able to service requests. Joe wants to run a command / module on every minion matching the grain glob ```role:appserver```, but only wants to run it on 10% of the total at a time.

salt -G role:appserver --batch 10%

Same Joe Dirt, same scenario, but this time, he only wants to do batches of 5 at a time:

salt -G role:appserver --batch 5

The general idea is that you have 3 phases for this:

1. Discovery phase. This is essentially a ```test.ping```
2. Execution phase. Run the commands in batches synchronously waiting ```$TIMEOUT``` for each batch to finish, and then on to the next batch.
3. Completion. Small summary with number of succeeded and failed or whatnot.

It makes the most sense in this scenario to use the new ```iter_cmd``` functionality to return results as they come in.