The following is an excerpt from Chapter 5 of Ansible for DevOps, a book on Ansible by Jeff Geerling.
Introduced in Ansible 2.0.0 (still in active development, currently in alpha), Blocks allow you to group related tasks together and apply particular task parameters on the block level. They also allow you to handle errors inside the blocks in a way similar to most programming languages' exception handling.
Here's an example playbook that uses blocks with
when to run group of tasks specific to one platform without
when parameters on each task: