Blocks.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Wed, 04 Nov 2020 21:52:41 +0200
changeset 2448 1a02d5429a5d
parent 2447 cb043d4756a2
child 2449 508963deb620
Blocks.
ansible.rst
--- a/ansible.rst	Wed Nov 04 21:46:58 2020 +0200
+++ b/ansible.rst	Wed Nov 04 21:52:41 2020 +0200
@@ -180,3 +180,19 @@
 * With ``free`` strategy tasks are executed without waiting for completion of the same task on every
   host.
 
+Blocks
+======
+
+To avoid repetitive checks or to handle failures use ``block``::
+
+  block:
+  - shell: echo do 1
+  - shell: echo do 2
+  when: not db_started
+  become: true
+  become_user: dba
+  rescue:
+  - shell: echo rollback
+  always:
+  - shell: echo notify
+