How to Use Blocks in Ansible Playbooks
· via Spacelift
Summary: Blocks are the structure feature people discover late. A when on a block beats copying the same when across ten tasks, and the same goes for become and tags. Rescue turns a failed task into a handled path, and always runs regardless of outcome, which is where cleanup belongs.
Who should read it: playbook authors whose error strategy is currently ignore_errors, and anyone tidying repetitive task lists.