Address only a few hosts at a time
If you have a batch of a number of hosts, say 500, and are modelling a rolling update process against those hosts, you may know how many hosts you want to allow to execute a play at a given time. Say this number is 10.
---
- hosts: all
serial: 10
tasks:
- name: ping
action: ping
You can replace 'ping' with whatever real actions you would want to execute, of course.
The result is that 10 hosts will completely finish the play before the other 10.
Leaving off "serial: 10" would result in each host in the 500 executing each task in order, which is not optimal in a production deployment scenario.
To ensure parallelism of updating those 10 as fast as possible, execute ansible playbook like so:
ansible-playbook playbook.yml --forks 10
Increasing --forks beyond the value of serial will have no effect, however increasing serial beyond the value of forks /does/ still have an effect, you are just not updating those in the batch at the maximum level of parallelism.